-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(namada): add 4 more abci queries
- Loading branch information
Showing
3 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { decode, u64 } from '@hackbg/borshest' | ||
import type { NamadaConnection as Connection } from './namada-connection' | ||
|
||
export async function fetchDenomination (connection: Connection, token: string) { | ||
const binary = await connection.abciQuery(`/vp/token/denomination/${token}`) | ||
return connection.decode.denomination(binary) | ||
} | ||
export async function fetchTotalSupply (connection: Connection, token: string) { | ||
const binary = await connection.abciQuery(`/vp/token/total_supply/${token}`) | ||
return decode(u64, binary) | ||
} | ||
export async function fetchEffectiveNativeSupply (connection: Connection) { | ||
const binary = await connection.abciQuery(`/vp/token/effective_native_supply`) | ||
return decode(u64, binary) | ||
} | ||
export async function fetchStakingRewardsRate (connection: Connection) { | ||
const binary = await connection.abciQuery(`/vp/token/staking_rewards_rate`) | ||
return connection.decode.pos_rewards_rates(binary) | ||
} |