-
Notifications
You must be signed in to change notification settings - Fork 196
02QueryingEthereum
Ivan Angelkoski edited this page Jun 12, 2023
·
5 revisions
Example code snippets to query data from Ethereum.
- Get the user's deposits on ethereum chain
import { ApolloConsumer } from "@injectivelabs/sdk-ts";
import { getNetworkEndpoints, Network } from "@injectivelabs/networks";
import { peggyGraphQlEndpointForNetwork } from "@injectivelabs/sdk-ui-ts";
const apolloConsumer = new ApolloConsumer(
peggyGraphQlEndpointForNetwork(Network.TestnetK8s)
);
const ethereumAddress = "0x...";
const userDeposits = apolloConsumer.fetchUserDeposits(ethereumAddress);
console.log(userDeposits);
- Get the user's deposits on ethereum chain at a specific time
import { ApolloConsumer } from "@injectivelabs/sdk-ts";
import { getNetworkEndpoints, Network } from "@injectivelabs/networks";
import { peggyGraphQlEndpointForNetwork } from "@injectivelabs/sdk-ui-ts";
const apolloConsumer = new ApolloConsumer(
peggyGraphQlEndpointForNetwork(Network.TestnetK8s)
);
const ethereumAddress = "0x...";
const timestamp = 13434333;
const userDeposits = apolloConsumer.fetchUserBridgeDeposits(
ethereumAddress,
timestamp
);
console.log(userDeposits);
Powering the future of decentralized finance.