Skip to content

Commit

Permalink
feat: add configs writeup (#913)
Browse files Browse the repository at this point in the history
  • Loading branch information
canhtrinh authored Jul 1, 2024
1 parent e32e3b1 commit b470a70
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/layouts/navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,12 @@ export const getNavigation = (section) => {
{ title: "Free Public RPC", href: "/resources/rpc/lava-iprpc" },
],
},
{
title: "Static configs",
children: [
{ title: "Static configs", href: "/resources/static-configs/static-configs" }
],
},
{
title: "Tokens",
children: [
Expand Down
46 changes: 46 additions & 0 deletions src/pages/resources/static-configs/static-configs.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Static configs

## Introduction

All of the static constants that are relevant for the chain have been aggregated into a single file.

This includes, but is not limited to:
* Chain info and its relevant configs
* All supported assets on each chain

The configuration documents are versioned so you will know if the object changes.

You can access the configs in one of two ways:

## Point the json files directly

* Testnet: https://axelar-testnet.s3.us-east-2.amazonaws.com/configs/testnet-config-1.x.json
* Mainnet: https://axelar-mainnet.s3.us-east-2.amazonaws.com/configs/mainnet-config-1.x.json


## Typescript API

Alternatively, you can use the hooks, i.e.

The package can be installed into your dApp as a project dependency with:
```bash
npm i @@axelarjs/api
```

Then run
```typescript

import { createAxelarConfigClient } from "@axelarjs/api";
import { ENVIRONMENTS } from "@axelarjs/core";

const test = async () => {
const api = createAxelarConfigClient(ENVIRONMENTS.testnet);
const configs = await api.getAxelarConfigs(ENVIRONMENTS.testnet);
Object.entries(configs.chains).forEach((v) =>
console.log(`config for chain ${v[0]}: ${v[1]}`)
);
};
test();
```

Each of the relevant properties in the schema are typed out in the following Typescript interfaces: https://github.com/axelarnetwork/axelarjs/blob/main/packages/api/src/axelar-config/types.ts

0 comments on commit b470a70

Please sign in to comment.