Created
January 20, 2021 08:04
-
-
Save fadeev/bdea2cac220d1ff132c2d486e3cbc89a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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