Facade
Contract queries and query builder for Lido Terra Finance projects.
Part of Lido JS SDK
Install
yarn add @lido-terra-sdk/facade
Address provider
import { CHAIN, NETWORK, NETWORK_URL } from '@lido-terra-sdk/constants';
import { LCDClient } from '@terra-money/terra.js';
import { LidoTerraAddressProvider } from '@lido-terra-sdk/facade';
const lcd = new LCDClient({
URL: NETWORK_URL[NETWORK.TESTNET],
chainID: CHAIN[NETWORK.TESTNET].BOMBAY12,
});
const addressProvider = new LidoTerraAddressProvider(NETWORK.TESTNET, lcd);
const { hub, airdropRegistryContract } = await addressProvider.getAddresses();
Contract queries
Source
Hub
import { CHAIN, NETWORK, NETWORK_URL } from '@lido-terra-sdk/constants';
import { LCDClient } from '@terra-money/terra.js';
import { LidoTerraAddressProvider } from '@lido-terra-sdk/facade';
const lcd = new LCDClient({
URL: NETWORK_URL[NETWORK.TESTNET],
chainID: CHAIN[NETWORK.TESTNET].BOMBAY12,
});
const addressProvider = new LidoTerraAddressProvider(NETWORK.TESTNET, lcd);
const contract = new LidoTerraHub(NETWORK.TESTNET, lcd, addressProvider);
const config = await contract.getConfig();
bLuna token
import { CHAIN, NETWORK, NETWORK_URL } from '@lido-terra-sdk/constants';
import { LCDClient } from '@terra-money/terra.js';
import {
LidoTerraAddressProvider,
LidoTerraBLunaToken,
} from '@lido-terra-sdk/facade';
const lcd = new LCDClient({
URL: NETWORK_URL[NETWORK.TESTNET],
chainID: CHAIN[NETWORK.TESTNET].BOMBAY12,
});
const addressProvider = new LidoTerraAddressProvider(NETWORK.TESTNET, lcd);
const contract = new LidoTerraBLunaToken(NETWORK.TESTNET, lcd, addressProvider);
const config = await contract.getConfig();
stLuna token
import { CHAIN, NETWORK, NETWORK_URL } from '@lido-terra-sdk/constants';
import { LCDClient } from '@terra-money/terra.js';
import {
LidoTerraAddressProvider,
LidoTerraStLunaToken,
} from '@lido-terra-sdk/facade';
const lcd = new LCDClient({
URL: NETWORK_URL[NETWORK.TESTNET],
chainID: CHAIN[NETWORK.TESTNET].BOMBAY12,
});
const addressProvider = new LidoTerraAddressProvider(NETWORK.TESTNET, lcd);
const contract = new LidoTerraStLunaToken(
NETWORK.TESTNET,
lcd,
addressProvider,
);
const config = await contract.getConfig();
Validators registry
import { CHAIN, NETWORK, NETWORK_URL } from '@lido-terra-sdk/constants';
import { LCDClient } from '@terra-money/terra.js';
import {
LidoTerraAddressProvider,
LidoTerraValidatorsRegistry,
} from '@lido-terra-sdk/facade';
const lcd = new LCDClient({
URL: NETWORK_URL[NETWORK.TESTNET],
chainID: CHAIN[NETWORK.TESTNET].BOMBAY12,
});
const addressProvider = new LidoTerraAddressProvider(NETWORK.TESTNET, lcd);
const contract = new LidoTerraValidatorsRegistry(
NETWORK.TESTNET,
lcd,
addressProvider,
);
const config = await contract.getConfig();
Rewards contract
import { CHAIN, NETWORK, NETWORK_URL } from '@lido-terra-sdk/constants';
import { LCDClient } from '@terra-money/terra.js';
import {
LidoTerraAddressProvider,
LidoTerraRewards,
} from '@lido-terra-sdk/facade';
const lcd = new LCDClient({
URL: NETWORK_URL[NETWORK.TESTNET],
chainID: CHAIN[NETWORK.TESTNET].BOMBAY12,
});
const addressProvider = new LidoTerraAddressProvider(NETWORK.TESTNET, lcd);
const contract = new LidoTerraRewards(NETWORK.TESTNET, lcd, addressProvider);
const config = await contract.getConfig();
Airdrop registry
import { CHAIN, NETWORK, NETWORK_URL } from '@lido-terra-sdk/constants';
import { LCDClient } from '@terra-money/terra.js';
import {
LidoTerraAirdropRegistry,
LidoTerraRewards,
} from '@lido-terra-sdk/facade';
const lcd = new LCDClient({
URL: NETWORK_URL[NETWORK.TESTNET],
chainID: CHAIN[NETWORK.TESTNET].BOMBAY12,
});
const addressProvider = new LidoTerraAirdropRegistry(NETWORK.TESTNET, lcd);
const contract = new LidoTerraRewards(NETWORK.TESTNET, lcd, addressProvider);
const config = await contract.getConfig();