import { txClient, queryClient, MissingWalletError , registry} from './module' // @ts-ignore import { SpVuexError } from '@starport/vuex' import { Params } from "./module/types/crescent/liquidity/v1beta1/liquidity" import { Pair } from "./module/types/crescent/liquidity/v1beta1/liquidity" import { Pool } from "./module/types/crescent/liquidity/v1beta1/liquidity" import { DepositRequest } from "./module/types/crescent/liquidity/v1beta1/liquidity" import { WithdrawRequest } from "./module/types/crescent/liquidity/v1beta1/liquidity" import { Order } from "./module/types/crescent/liquidity/v1beta1/liquidity" import { PoolResponse } from "./module/types/crescent/liquidity/v1beta1/query" export { Params, Pair, Pool, DepositRequest, WithdrawRequest, Order, PoolResponse }; async function initTxClient(vuexGetters) { return await txClient(vuexGetters['common/wallet/signer'], { addr: vuexGetters['common/env/apiTendermint'] }) } async function initQueryClient(vuexGetters) { return await queryClient({ addr: vuexGetters['common/env/apiCosmos'] }) } function mergeResults(value, next_values) { for (let prop of Object.keys(next_values)) { if (Array.isArray(next_values[prop])) { value[prop]=[...value[prop], ...next_values[prop]] }else{ value[prop]=next_values[prop] } } return value } function getStructure(template) { let structure = { fields: [] } for (const [key, value] of Object.entries(template)) { let field: any = {} field.name = key field.type = typeof value structure.fields.push(field) } return structure } const getDefaultState = () => { return { Params: {}, Pools: {}, Pool: {}, PoolByReserveAddress: {}, PoolByPoolCoinDenom: {}, Pairs: {}, Pair: {}, DepositRequests: {}, DepositRequest: {}, WithdrawRequests: {}, WithdrawRequest: {}, Orders: {}, Order: {}, OrdersByOrderer: {}, _Structure: { Params: getStructure(Params.fromPartial({})), Pair: getStructure(Pair.fromPartial({})), Pool: getStructure(Pool.fromPartial({})), DepositRequest: getStructure(DepositRequest.fromPartial({})), WithdrawRequest: getStructure(WithdrawRequest.fromPartial({})), Order: getStructure(Order.fromPartial({})), PoolResponse: getStructure(PoolResponse.fromPartial({})), }, _Registry: registry, _Subscriptions: new Set(), } } // initial state const state = getDefaultState() export default { namespaced: true, state, mutations: { RESET_STATE(state) { Object.assign(state, getDefaultState()) }, QUERY(state, { query, key, value }) { state[query][JSON.stringify(key)] = value }, SUBSCRIBE(state, subscription) { state._Subscriptions.add(JSON.stringify(subscription)) }, UNSUBSCRIBE(state, subscription) { state._Subscriptions.delete(JSON.stringify(subscription)) } }, getters: { getParams: (state) => (params = { params: {}}) => { if (!( params).query) { ( params).query=null } return state.Params[JSON.stringify(params)] ?? {} }, getPools: (state) => (params = { params: {}}) => { if (!( params).query) { ( params).query=null } return state.Pools[JSON.stringify(params)] ?? {} }, getPool: (state) => (params = { params: {}}) => { if (!( params).query) { ( params).query=null } return state.Pool[JSON.stringify(params)] ?? {} }, getPoolByReserveAddress: (state) => (params = { params: {}}) => { if (!( params).query) { ( params).query=null } return state.PoolByReserveAddress[JSON.stringify(params)] ?? {} }, getPoolByPoolCoinDenom: (state) => (params = { params: {}}) => { if (!( params).query) { ( params).query=null } return state.PoolByPoolCoinDenom[JSON.stringify(params)] ?? {} }, getPairs: (state) => (params = { params: {}}) => { if (!( params).query) { ( params).query=null } return state.Pairs[JSON.stringify(params)] ?? {} }, getPair: (state) => (params = { params: {}}) => { if (!( params).query) { ( params).query=null } return state.Pair[JSON.stringify(params)] ?? {} }, getDepositRequests: (state) => (params = { params: {}}) => { if (!( params).query) { ( params).query=null } return state.DepositRequests[JSON.stringify(params)] ?? {} }, getDepositRequest: (state) => (params = { params: {}}) => { if (!( params).query) { ( params).query=null } return state.DepositRequest[JSON.stringify(params)] ?? {} }, getWithdrawRequests: (state) => (params = { params: {}}) => { if (!( params).query) { ( params).query=null } return state.WithdrawRequests[JSON.stringify(params)] ?? {} }, getWithdrawRequest: (state) => (params = { params: {}}) => { if (!( params).query) { ( params).query=null } return state.WithdrawRequest[JSON.stringify(params)] ?? {} }, getOrders: (state) => (params = { params: {}}) => { if (!( params).query) { ( params).query=null } return state.Orders[JSON.stringify(params)] ?? {} }, getOrder: (state) => (params = { params: {}}) => { if (!( params).query) { ( params).query=null } return state.Order[JSON.stringify(params)] ?? {} }, getOrdersByOrderer: (state) => (params = { params: {}}) => { if (!( params).query) { ( params).query=null } return state.OrdersByOrderer[JSON.stringify(params)] ?? {} }, getTypeStructure: (state) => (type) => { return state._Structure[type].fields }, getRegistry: (state) => { return state._Registry } }, actions: { init({ dispatch, rootGetters }) { console.log('Vuex module: crescent.liquidity.v1beta1 initialized!') if (rootGetters['common/env/client']) { rootGetters['common/env/client'].on('newblock', () => { dispatch('StoreUpdate') }) } }, resetState({ commit }) { commit('RESET_STATE') }, unsubscribe({ commit }, subscription) { commit('UNSUBSCRIBE', subscription) }, async StoreUpdate({ state, dispatch }) { state._Subscriptions.forEach(async (subscription) => { try { const sub=JSON.parse(subscription) await dispatch(sub.action, sub.payload) }catch(e) { throw new SpVuexError('Subscriptions: ' + e.message) } }) }, async QueryParams({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { try { const key = params ?? {}; const queryClient=await initQueryClient(rootGetters) let value= (await queryClient.queryParams()).data commit('QUERY', { query: 'Params', key: { params: {...key}, query}, value }) if (subscribe) commit('SUBSCRIBE', { action: 'QueryParams', payload: { options: { all }, params: {...key},query }}) return getters['getParams']( { params: {...key}, query}) ?? {} } catch (e) { throw new SpVuexError('QueryClient:QueryParams', 'API Node Unavailable. Could not perform query: ' + e.message) } }, async QueryPools({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { try { const key = params ?? {}; const queryClient=await initQueryClient(rootGetters) let value= (await queryClient.queryPools(query)).data while (all && ( value).pagination && ( value).pagination.next_key!=null) { let next_values=(await queryClient.queryPools({...query, 'pagination.key':( value).pagination.next_key})).data value = mergeResults(value, next_values); } commit('QUERY', { query: 'Pools', key: { params: {...key}, query}, value }) if (subscribe) commit('SUBSCRIBE', { action: 'QueryPools', payload: { options: { all }, params: {...key},query }}) return getters['getPools']( { params: {...key}, query}) ?? {} } catch (e) { throw new SpVuexError('QueryClient:QueryPools', 'API Node Unavailable. Could not perform query: ' + e.message) } }, async QueryPool({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { try { const key = params ?? {}; const queryClient=await initQueryClient(rootGetters) let value= (await queryClient.queryPool( key.pool_id)).data commit('QUERY', { query: 'Pool', key: { params: {...key}, query}, value }) if (subscribe) commit('SUBSCRIBE', { action: 'QueryPool', payload: { options: { all }, params: {...key},query }}) return getters['getPool']( { params: {...key}, query}) ?? {} } catch (e) { throw new SpVuexError('QueryClient:QueryPool', 'API Node Unavailable. Could not perform query: ' + e.message) } }, async QueryPoolByReserveAddress({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { try { const key = params ?? {}; const queryClient=await initQueryClient(rootGetters) let value= (await queryClient.queryPoolByReserveAddress( key.reserve_address)).data commit('QUERY', { query: 'PoolByReserveAddress', key: { params: {...key}, query}, value }) if (subscribe) commit('SUBSCRIBE', { action: 'QueryPoolByReserveAddress', payload: { options: { all }, params: {...key},query }}) return getters['getPoolByReserveAddress']( { params: {...key}, query}) ?? {} } catch (e) { throw new SpVuexError('QueryClient:QueryPoolByReserveAddress', 'API Node Unavailable. Could not perform query: ' + e.message) } }, async QueryPoolByPoolCoinDenom({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { try { const key = params ?? {}; const queryClient=await initQueryClient(rootGetters) let value= (await queryClient.queryPoolByPoolCoinDenom( key.pool_coin_denom)).data commit('QUERY', { query: 'PoolByPoolCoinDenom', key: { params: {...key}, query}, value }) if (subscribe) commit('SUBSCRIBE', { action: 'QueryPoolByPoolCoinDenom', payload: { options: { all }, params: {...key},query }}) return getters['getPoolByPoolCoinDenom']( { params: {...key}, query}) ?? {} } catch (e) { throw new SpVuexError('QueryClient:QueryPoolByPoolCoinDenom', 'API Node Unavailable. Could not perform query: ' + e.message) } }, async QueryPairs({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { try { const key = params ?? {}; const queryClient=await initQueryClient(rootGetters) let value= (await queryClient.queryPairs(query)).data while (all && ( value).pagination && ( value).pagination.next_key!=null) { let next_values=(await queryClient.queryPairs({...query, 'pagination.key':( value).pagination.next_key})).data value = mergeResults(value, next_values); } commit('QUERY', { query: 'Pairs', key: { params: {...key}, query}, value }) if (subscribe) commit('SUBSCRIBE', { action: 'QueryPairs', payload: { options: { all }, params: {...key},query }}) return getters['getPairs']( { params: {...key}, query}) ?? {} } catch (e) { throw new SpVuexError('QueryClient:QueryPairs', 'API Node Unavailable. Could not perform query: ' + e.message) } }, async QueryPair({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { try { const key = params ?? {}; const queryClient=await initQueryClient(rootGetters) let value= (await queryClient.queryPair( key.pair_id)).data commit('QUERY', { query: 'Pair', key: { params: {...key}, query}, value }) if (subscribe) commit('SUBSCRIBE', { action: 'QueryPair', payload: { options: { all }, params: {...key},query }}) return getters['getPair']( { params: {...key}, query}) ?? {} } catch (e) { throw new SpVuexError('QueryClient:QueryPair', 'API Node Unavailable. Could not perform query: ' + e.message) } }, async QueryDepositRequests({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { try { const key = params ?? {}; const queryClient=await initQueryClient(rootGetters) let value= (await queryClient.queryDepositRequests( key.pool_id, query)).data while (all && ( value).pagination && ( value).pagination.next_key!=null) { let next_values=(await queryClient.queryDepositRequests( key.pool_id, {...query, 'pagination.key':( value).pagination.next_key})).data value = mergeResults(value, next_values); } commit('QUERY', { query: 'DepositRequests', key: { params: {...key}, query}, value }) if (subscribe) commit('SUBSCRIBE', { action: 'QueryDepositRequests', payload: { options: { all }, params: {...key},query }}) return getters['getDepositRequests']( { params: {...key}, query}) ?? {} } catch (e) { throw new SpVuexError('QueryClient:QueryDepositRequests', 'API Node Unavailable. Could not perform query: ' + e.message) } }, async QueryDepositRequest({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { try { const key = params ?? {}; const queryClient=await initQueryClient(rootGetters) let value= (await queryClient.queryDepositRequest( key.pool_id, key.id)).data commit('QUERY', { query: 'DepositRequest', key: { params: {...key}, query}, value }) if (subscribe) commit('SUBSCRIBE', { action: 'QueryDepositRequest', payload: { options: { all }, params: {...key},query }}) return getters['getDepositRequest']( { params: {...key}, query}) ?? {} } catch (e) { throw new SpVuexError('QueryClient:QueryDepositRequest', 'API Node Unavailable. Could not perform query: ' + e.message) } }, async QueryWithdrawRequests({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { try { const key = params ?? {}; const queryClient=await initQueryClient(rootGetters) let value= (await queryClient.queryWithdrawRequests( key.pool_id, query)).data while (all && ( value).pagination && ( value).pagination.next_key!=null) { let next_values=(await queryClient.queryWithdrawRequests( key.pool_id, {...query, 'pagination.key':( value).pagination.next_key})).data value = mergeResults(value, next_values); } commit('QUERY', { query: 'WithdrawRequests', key: { params: {...key}, query}, value }) if (subscribe) commit('SUBSCRIBE', { action: 'QueryWithdrawRequests', payload: { options: { all }, params: {...key},query }}) return getters['getWithdrawRequests']( { params: {...key}, query}) ?? {} } catch (e) { throw new SpVuexError('QueryClient:QueryWithdrawRequests', 'API Node Unavailable. Could not perform query: ' + e.message) } }, async QueryWithdrawRequest({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { try { const key = params ?? {}; const queryClient=await initQueryClient(rootGetters) let value= (await queryClient.queryWithdrawRequest( key.pool_id, key.id)).data commit('QUERY', { query: 'WithdrawRequest', key: { params: {...key}, query}, value }) if (subscribe) commit('SUBSCRIBE', { action: 'QueryWithdrawRequest', payload: { options: { all }, params: {...key},query }}) return getters['getWithdrawRequest']( { params: {...key}, query}) ?? {} } catch (e) { throw new SpVuexError('QueryClient:QueryWithdrawRequest', 'API Node Unavailable. Could not perform query: ' + e.message) } }, async QueryOrders({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { try { const key = params ?? {}; const queryClient=await initQueryClient(rootGetters) let value= (await queryClient.queryOrders( key.pair_id, query)).data while (all && ( value).pagination && ( value).pagination.next_key!=null) { let next_values=(await queryClient.queryOrders( key.pair_id, {...query, 'pagination.key':( value).pagination.next_key})).data value = mergeResults(value, next_values); } commit('QUERY', { query: 'Orders', key: { params: {...key}, query}, value }) if (subscribe) commit('SUBSCRIBE', { action: 'QueryOrders', payload: { options: { all }, params: {...key},query }}) return getters['getOrders']( { params: {...key}, query}) ?? {} } catch (e) { throw new SpVuexError('QueryClient:QueryOrders', 'API Node Unavailable. Could not perform query: ' + e.message) } }, async QueryOrder({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { try { const key = params ?? {}; const queryClient=await initQueryClient(rootGetters) let value= (await queryClient.queryOrder( key.pair_id, key.id)).data commit('QUERY', { query: 'Order', key: { params: {...key}, query}, value }) if (subscribe) commit('SUBSCRIBE', { action: 'QueryOrder', payload: { options: { all }, params: {...key},query }}) return getters['getOrder']( { params: {...key}, query}) ?? {} } catch (e) { throw new SpVuexError('QueryClient:QueryOrder', 'API Node Unavailable. Could not perform query: ' + e.message) } }, async QueryOrdersByOrderer({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { try { const key = params ?? {}; const queryClient=await initQueryClient(rootGetters) let value= (await queryClient.queryOrdersByOrderer( key.orderer, query)).data while (all && ( value).pagination && ( value).pagination.next_key!=null) { let next_values=(await queryClient.queryOrdersByOrderer( key.orderer, {...query, 'pagination.key':( value).pagination.next_key})).data value = mergeResults(value, next_values); } commit('QUERY', { query: 'OrdersByOrderer', key: { params: {...key}, query}, value }) if (subscribe) commit('SUBSCRIBE', { action: 'QueryOrdersByOrderer', payload: { options: { all }, params: {...key},query }}) return getters['getOrdersByOrderer']( { params: {...key}, query}) ?? {} } catch (e) { throw new SpVuexError('QueryClient:QueryOrdersByOrderer', 'API Node Unavailable. Could not perform query: ' + e.message) } }, async sendMsgMarketOrder({ rootGetters }, { value, fee = [], memo = '' }) { try { const txClient=await initTxClient(rootGetters) const msg = await txClient.msgMarketOrder(value) const result = await txClient.signAndBroadcast([msg], {fee: { amount: fee, gas: "200000" }, memo}) return result } catch (e) { if (e == MissingWalletError) { throw new SpVuexError('TxClient:MsgMarketOrder:Init', 'Could not initialize signing client. Wallet is required.') }else{ throw new SpVuexError('TxClient:MsgMarketOrder:Send', 'Could not broadcast Tx: '+ e.message) } } }, async sendMsgCreatePool({ rootGetters }, { value, fee = [], memo = '' }) { try { const txClient=await initTxClient(rootGetters) const msg = await txClient.msgCreatePool(value) const result = await txClient.signAndBroadcast([msg], {fee: { amount: fee, gas: "200000" }, memo}) return result } catch (e) { if (e == MissingWalletError) { throw new SpVuexError('TxClient:MsgCreatePool:Init', 'Could not initialize signing client. Wallet is required.') }else{ throw new SpVuexError('TxClient:MsgCreatePool:Send', 'Could not broadcast Tx: '+ e.message) } } }, async sendMsgLimitOrder({ rootGetters }, { value, fee = [], memo = '' }) { try { const txClient=await initTxClient(rootGetters) const msg = await txClient.msgLimitOrder(value) const result = await txClient.signAndBroadcast([msg], {fee: { amount: fee, gas: "200000" }, memo}) return result } catch (e) { if (e == MissingWalletError) { throw new SpVuexError('TxClient:MsgLimitOrder:Init', 'Could not initialize signing client. Wallet is required.') }else{ throw new SpVuexError('TxClient:MsgLimitOrder:Send', 'Could not broadcast Tx: '+ e.message) } } }, async sendMsgCreatePair({ rootGetters }, { value, fee = [], memo = '' }) { try { const txClient=await initTxClient(rootGetters) const msg = await txClient.msgCreatePair(value) const result = await txClient.signAndBroadcast([msg], {fee: { amount: fee, gas: "200000" }, memo}) return result } catch (e) { if (e == MissingWalletError) { throw new SpVuexError('TxClient:MsgCreatePair:Init', 'Could not initialize signing client. Wallet is required.') }else{ throw new SpVuexError('TxClient:MsgCreatePair:Send', 'Could not broadcast Tx: '+ e.message) } } }, async sendMsgDeposit({ rootGetters }, { value, fee = [], memo = '' }) { try { const txClient=await initTxClient(rootGetters) const msg = await txClient.msgDeposit(value) const result = await txClient.signAndBroadcast([msg], {fee: { amount: fee, gas: "200000" }, memo}) return result } catch (e) { if (e == MissingWalletError) { throw new SpVuexError('TxClient:MsgDeposit:Init', 'Could not initialize signing client. Wallet is required.') }else{ throw new SpVuexError('TxClient:MsgDeposit:Send', 'Could not broadcast Tx: '+ e.message) } } }, async sendMsgCancelAllOrders({ rootGetters }, { value, fee = [], memo = '' }) { try { const txClient=await initTxClient(rootGetters) const msg = await txClient.msgCancelAllOrders(value) const result = await txClient.signAndBroadcast([msg], {fee: { amount: fee, gas: "200000" }, memo}) return result } catch (e) { if (e == MissingWalletError) { throw new SpVuexError('TxClient:MsgCancelAllOrders:Init', 'Could not initialize signing client. Wallet is required.') }else{ throw new SpVuexError('TxClient:MsgCancelAllOrders:Send', 'Could not broadcast Tx: '+ e.message) } } }, async sendMsgWithdraw({ rootGetters }, { value, fee = [], memo = '' }) { try { const txClient=await initTxClient(rootGetters) const msg = await txClient.msgWithdraw(value) const result = await txClient.signAndBroadcast([msg], {fee: { amount: fee, gas: "200000" }, memo}) return result } catch (e) { if (e == MissingWalletError) { throw new SpVuexError('TxClient:MsgWithdraw:Init', 'Could not initialize signing client. Wallet is required.') }else{ throw new SpVuexError('TxClient:MsgWithdraw:Send', 'Could not broadcast Tx: '+ e.message) } } }, async sendMsgCancelOrder({ rootGetters }, { value, fee = [], memo = '' }) { try { const txClient=await initTxClient(rootGetters) const msg = await txClient.msgCancelOrder(value) const result = await txClient.signAndBroadcast([msg], {fee: { amount: fee, gas: "200000" }, memo}) return result } catch (e) { if (e == MissingWalletError) { throw new SpVuexError('TxClient:MsgCancelOrder:Init', 'Could not initialize signing client. Wallet is required.') }else{ throw new SpVuexError('TxClient:MsgCancelOrder:Send', 'Could not broadcast Tx: '+ e.message) } } }, async MsgMarketOrder({ rootGetters }, { value }) { try { const txClient=await initTxClient(rootGetters) const msg = await txClient.msgMarketOrder(value) return msg } catch (e) { if (e == MissingWalletError) { throw new SpVuexError('TxClient:MsgMarketOrder:Init', 'Could not initialize signing client. Wallet is required.') }else{ throw new SpVuexError('TxClient:MsgMarketOrder:Create', 'Could not create message: ' + e.message) } } }, async MsgCreatePool({ rootGetters }, { value }) { try { const txClient=await initTxClient(rootGetters) const msg = await txClient.msgCreatePool(value) return msg } catch (e) { if (e == MissingWalletError) { throw new SpVuexError('TxClient:MsgCreatePool:Init', 'Could not initialize signing client. Wallet is required.') }else{ throw new SpVuexError('TxClient:MsgCreatePool:Create', 'Could not create message: ' + e.message) } } }, async MsgLimitOrder({ rootGetters }, { value }) { try { const txClient=await initTxClient(rootGetters) const msg = await txClient.msgLimitOrder(value) return msg } catch (e) { if (e == MissingWalletError) { throw new SpVuexError('TxClient:MsgLimitOrder:Init', 'Could not initialize signing client. Wallet is required.') }else{ throw new SpVuexError('TxClient:MsgLimitOrder:Create', 'Could not create message: ' + e.message) } } }, async MsgCreatePair({ rootGetters }, { value }) { try { const txClient=await initTxClient(rootGetters) const msg = await txClient.msgCreatePair(value) return msg } catch (e) { if (e == MissingWalletError) { throw new SpVuexError('TxClient:MsgCreatePair:Init', 'Could not initialize signing client. Wallet is required.') }else{ throw new SpVuexError('TxClient:MsgCreatePair:Create', 'Could not create message: ' + e.message) } } }, async MsgDeposit({ rootGetters }, { value }) { try { const txClient=await initTxClient(rootGetters) const msg = await txClient.msgDeposit(value) return msg } catch (e) { if (e == MissingWalletError) { throw new SpVuexError('TxClient:MsgDeposit:Init', 'Could not initialize signing client. Wallet is required.') }else{ throw new SpVuexError('TxClient:MsgDeposit:Create', 'Could not create message: ' + e.message) } } }, async MsgCancelAllOrders({ rootGetters }, { value }) { try { const txClient=await initTxClient(rootGetters) const msg = await txClient.msgCancelAllOrders(value) return msg } catch (e) { if (e == MissingWalletError) { throw new SpVuexError('TxClient:MsgCancelAllOrders:Init', 'Could not initialize signing client. Wallet is required.') }else{ throw new SpVuexError('TxClient:MsgCancelAllOrders:Create', 'Could not create message: ' + e.message) } } }, async MsgWithdraw({ rootGetters }, { value }) { try { const txClient=await initTxClient(rootGetters) const msg = await txClient.msgWithdraw(value) return msg } catch (e) { if (e == MissingWalletError) { throw new SpVuexError('TxClient:MsgWithdraw:Init', 'Could not initialize signing client. Wallet is required.') }else{ throw new SpVuexError('TxClient:MsgWithdraw:Create', 'Could not create message: ' + e.message) } } }, async MsgCancelOrder({ rootGetters }, { value }) { try { const txClient=await initTxClient(rootGetters) const msg = await txClient.msgCancelOrder(value) return msg } catch (e) { if (e == MissingWalletError) { throw new SpVuexError('TxClient:MsgCancelOrder:Init', 'Could not initialize signing client. Wallet is required.') }else{ throw new SpVuexError('TxClient:MsgCancelOrder:Create', 'Could not create message: ' + e.message) } } }, } }