-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ff9164f
commit bbc8087
Showing
18 changed files
with
416 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { writable } from 'svelte/store'; | ||
import { getAllBalances } from '../utils/balances'; | ||
|
||
/** | ||
* @type {import('../utils/query').ChainBalances[] | undefined} | ||
*/ | ||
let initialBalance = []; | ||
|
||
const balances = writable(initialBalance); | ||
|
||
export const fetchAllBalances = async () => { | ||
try { | ||
const balancesAll = await getAllBalances(); | ||
|
||
balances.set(balancesAll); | ||
} catch (error) { | ||
console.error("Error fetching balances:", error); | ||
throw error | ||
} | ||
}; | ||
|
||
export default balances; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { writable } from 'svelte/store'; | ||
import { type ChainClient, createAllChains } from '../utils/chains'; | ||
|
||
export const chains = writable<(ChainClient | null)[]>([]); | ||
|
||
export const fetchAllClients = async () => { | ||
try { | ||
const clients = await createAllChains(); | ||
|
||
chains.set(clients); | ||
} catch (error) { | ||
console.error('Error fetching all clients:', error); | ||
chains.set([]); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { getChainAddresses, getChains, snapId } from './snap'; | ||
import { queryBalances } from './query'; | ||
import type { ChainBalances } from './query'; | ||
|
||
export const getAllBalances = async (): Promise<ChainBalances[]> => { | ||
let addressesP = getChainAddresses(); | ||
|
||
let chainsP = getChains(); | ||
|
||
let [addresses, chains] = await Promise.all([addressesP, chainsP]); | ||
|
||
let balancesP = chains.map(chain => queryBalances(chain.apis.rpc[0].address, addresses.filter(item => item.chain_id === chain.chain_id)[0].address, chain.chain_id)); | ||
|
||
let balances = Promise.all(balancesP); | ||
|
||
return balances | ||
}; |
Oops, something went wrong.