Skip to content

Instantly share code, notes, and snippets.

@fadeev
Created January 20, 2021 08:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fadeev/bdea2cac220d1ff132c2d486e3cbc89a to your computer and use it in GitHub Desktop.
Save fadeev/bdea2cac220d1ff132c2d486e3cbc89a to your computer and use it in GitHub Desktop.
async QueryBalance(
{ commit, rootGetters },
{ payload, subscribe = false }
) {
const queryUrl = '/cosmos/bank/v1beta1/balances'
const queryParams = Object.keys(payload).join("/")
try {
const balance = await rootGetters['modules/env/apiClient'].query(
queryUrl,
queryParams
)
commit('Balance', { queryParams, balance })
if (subscribe) {
commit('Subscribe', {
action: 'QueryBalance',
payload
})
}
} catch (e) {
throw 'API Node unavailable'
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment