Skip to content

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
  • Balances
  • 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
  • Historical pricing

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
        }
      }
    }
    ...
  }
}
Clone this wiki locally