-
Notifications
You must be signed in to change notification settings - Fork 8
Data Sources
Dominic Sherman edited this page Aug 10, 2021
·
1 revision
- Mainnet assets
- L1 - etherscan
- L2 - blockscout
- Testnet assets
- Hard coded
- Prices and chart data
- L1 - coingecko
- map from etherscan to coin gecko token using token address
- L2 - honey swap/coingecko
- map from block scout to honey swap token using token address
- map honey swap token to coin gecko token using token symbol
- for some tokens, we get the
usdBalance
using the exchange rate API in the SDK
- L1 - coingecko
- Balances
- Balance checker contracts
- GitHub - wbobeirne/eth-balance-checker: Solidity contract to batch balance checks in one call
- We deployed our own instances of this contract for each network and store the address of the deployed instance within the SDK
- Prepaid cards/depots/merchant safes
- L1 - N/A
- L2 - card pay SDK
- Collectibles
- L1 - Opensea
- L2 - N/A
- Transactions
- L1 (main net) - Zerion
- L1 (testnet) - Local storage
- L2 - The graph
- Currency conversion rates
- Fixer API and then stored in Redux
- Coingecko automatically handles currency conversion for prices, but we use this when we need to manually do a conversion
- cardwallet/useLoadCurrencyConversionRates.js at develop · cardstack/cardwallet · GitHub
- Historical pricing
- cardwallet/historical-pricing-service.ts at develop · cardstack/cardwallet · GitHub
- Used for historical transaction data on L2, Zerion handles this for us in L1
min-api
- Implementing local caching so we never request the same historical price twice
In an ideal world, we’d be able to get all asset data on the list screen in a single GraphQL query and cache it using Apollo client, with built in loading/error handling. This could look something like the following:
model Price {
tokenAddress: string;
nativeCurrency: string;
amount: number;
}
model Token {
name: string;
symbol: string;
address: string;
decimals: number;
price: Price;
}
model Balance {
accountAddress: string;
account: Account;
amount: number;
tokenAddress: string;
token: Token;
}
model PrepaidCard {
id: string;
balances: Balance[];
...
}
model Depot {
id: string;
balances: Balance[];
...
}
model MerchantSafe {
id: string;
balances: Balance[];
...
}
model Account {
assetBalances: Balance[];
prepaidCards: PrepaidCard[];
depot: Depot;
merchantSafes: MerchantSafe[];
}
account(address: $id, nativeCurrency: $nativeCurrency) {
assetBalances {
amount
token {
name
symbol
address
price {
amount
}
}
}
prepaidCards {
id
balances {
amount
token {
name
symbol
address
price {
amount
}
}
}
...
}
depot {
id
balances {
amount
token {
name
symbol
address
price {
amount
}
}
}
...
}
merchantSafe {
id
balances {
amount
token {
name
symbol
address
price {
amount
}
}
}
...
}
}