Create HttpEndpoint interface

This commit is contained in:
Simon Warta
2022-04-13 06:57:34 +02:00
parent 244a4d8a84
commit 7d62e8fc0d
13 changed files with 95 additions and 22 deletions
+21
View File
@@ -0,0 +1,21 @@
import { StargateClient } from "@cosmjs/stargate";
// Network config
const rpcEndpoint = {
// Note: we removed the /status patch from the examples because we use the HTTP POST API
url: "https://cosmoshub-4--rpc--full.datahub.figment.io/",
headers: {
"Authorization": "5195ebb0bfb7f0fe5c43409240c8b2c4",
}
};
// Setup client
const client = await StargateClient.connect(rpcEndpoint);
// Get some data
const chainId = await client.getChainId();
console.log("Chain ID:", chainId);
const balance = await client.getAllBalances("cosmos1ey69r37gfxvxg62sh4r0ktpuc46pzjrmz29g45");
console.log("Balances:", balance);
client.disconnect();