Skip to content

Commit

Permalink
Generated client
Browse files Browse the repository at this point in the history
  • Loading branch information
fadeev committed Dec 14, 2021
1 parent 0061840 commit f87ed32
Show file tree
Hide file tree
Showing 592 changed files with 267,840 additions and 2 deletions.
7 changes: 5 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ require (
github.com/google/go-cmp v0.5.6 // indirect
github.com/gorilla/mux v1.8.0
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.1 // indirect
github.com/regen-network/cosmos-proto v0.3.1 // indirect
github.com/spf13/cast v1.3.1
github.com/spf13/cobra v1.1.3
github.com/stretchr/testify v1.7.0
github.com/tendermint/spm v0.1.5
github.com/tendermint/tendermint v0.34.13
github.com/tendermint/tm-db v0.6.4
google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83
google.golang.org/grpc v1.40.0
golang.org/x/tools v0.1.5 // indirect
google.golang.org/genproto v0.0.0-20211129164237-f09f9a12af12
google.golang.org/grpc v1.42.0
)

replace (
Expand Down
10 changes: 10 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
Expand Down Expand Up @@ -307,6 +308,8 @@ github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5x
github.com/gogo/gateway v1.1.0 h1:u0SuhL9+Il+UbjM9VIE3ntfRujKbvVpFvNB4HbjeVQ0=
github.com/gogo/gateway v1.1.0/go.mod h1:S7rR8FRQyG3QFESeSv4l2WnsyzlCLG0CzBbUUo/mbic=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ=
github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4=
github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
Expand Down Expand Up @@ -418,6 +421,8 @@ github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t
github.com/grpc-ecosystem/grpc-gateway v1.14.7/go.mod h1:oYZKL012gGh6LMyg/xA7Q2yq6j8bu0wa+9w14EEthWU=
github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo=
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.1 h1:p5m7GOEGXyoq6QWl4/RRMsQ6tWbTpbQmAnkxXgWSprY=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.1/go.mod h1:8ZeZajTed/blCOHBbj8Fss8bPHiFKcmJJzuIbUtFCAo=
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU=
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0=
github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s=
Expand Down Expand Up @@ -1001,6 +1006,7 @@ golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ
golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand Down Expand Up @@ -1245,6 +1251,8 @@ google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaE
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0=
google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83 h1:3V2dxSZpz4zozWWUq36vUxXEKnSYitEH2LdsAx+RUmg=
google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
google.golang.org/genproto v0.0.0-20211129164237-f09f9a12af12 h1:DN5b3HU13J4sMd/QjDx34U6afpaexKTDdop+26pdjdk=
google.golang.org/genproto v0.0.0-20211129164237-f09f9a12af12/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
google.golang.org/grpc v1.33.2 h1:EQyQC3sa8M+p6Ulc8yy9SWSS2GVwyRc83gAbG8lrl4o=
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
Expand Down Expand Up @@ -1310,4 +1318,6 @@ rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU=
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Loan } from "./module/types/loan/loan";
export { Loan };
declare const _default;
export default _default;
299 changes: 299 additions & 0 deletions vue/src/store/generated/cosmonaut/loan/cosmonaut.loan.loan/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,299 @@
import { txClient, queryClient, MissingWalletError } from './module';
// @ts-ignore
import { SpVuexError } from '@starport/vuex';
import { Loan } from "./module/types/loan/loan";
export { Loan };
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 = {};
field.name = key;
field.type = typeof value;
structure.fields.push(field);
}
return structure;
}
const getDefaultState = () => {
return {
Loan: {},
LoanAll: {},
_Structure: {
Loan: getStructure(Loan.fromPartial({})),
},
_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(subscription);
},
UNSUBSCRIBE(state, subscription) {
state._Subscriptions.delete(subscription);
}
},
getters: {
getLoan: (state) => (params = { params: {} }) => {
if (!params.query) {
params.query = null;
}
return state.Loan[JSON.stringify(params)] ?? {};
},
getLoanAll: (state) => (params = { params: {} }) => {
if (!params.query) {
params.query = null;
}
return state.LoanAll[JSON.stringify(params)] ?? {};
},
getTypeStructure: (state) => (type) => {
return state._Structure[type].fields;
}
},
actions: {
init({ dispatch, rootGetters }) {
console.log('Vuex module: cosmonaut.loan.loan 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 {
await dispatch(subscription.action, subscription.payload);
}
catch (e) {
throw new SpVuexError('Subscriptions: ' + e.message);
}
});
},
async QueryLoan({ commit, rootGetters, getters }, { options: { subscribe, all } = { subscribe: false, all: false }, params: { ...key }, query = null }) {
try {
const queryClient = await initQueryClient(rootGetters);
let value = (await queryClient.queryLoan(key.id)).data;
commit('QUERY', { query: 'Loan', key: { params: { ...key }, query }, value });
if (subscribe)
commit('SUBSCRIBE', { action: 'QueryLoan', payload: { options: { all }, params: { ...key }, query } });
return getters['getLoan']({ params: { ...key }, query }) ?? {};
}
catch (e) {
throw new SpVuexError('QueryClient:QueryLoan', 'API Node Unavailable. Could not perform query: ' + e.message);
}
},
async QueryLoanAll({ commit, rootGetters, getters }, { options: { subscribe, all } = { subscribe: false, all: false }, params: { ...key }, query = null }) {
try {
const queryClient = await initQueryClient(rootGetters);
let value = (await queryClient.queryLoanAll(query)).data;
while (all && value.pagination && value.pagination.nextKey != null) {
let next_values = (await queryClient.queryLoanAll({ ...query, 'pagination.key': value.pagination.nextKey })).data;
value = mergeResults(value, next_values);
}
commit('QUERY', { query: 'LoanAll', key: { params: { ...key }, query }, value });
if (subscribe)
commit('SUBSCRIBE', { action: 'QueryLoanAll', payload: { options: { all }, params: { ...key }, query } });
return getters['getLoanAll']({ params: { ...key }, query }) ?? {};
}
catch (e) {
throw new SpVuexError('QueryClient:QueryLoanAll', 'API Node Unavailable. Could not perform query: ' + e.message);
}
},
async sendMsgApproveLoan({ rootGetters }, { value, fee = [], memo = '' }) {
try {
const txClient = await initTxClient(rootGetters);
const msg = await txClient.msgApproveLoan(value);
const result = await txClient.signAndBroadcast([msg], { fee: { amount: fee,
gas: "200000" }, memo });
return result;
}
catch (e) {
if (e == MissingWalletError) {
throw new SpVuexError('TxClient:MsgApproveLoan:Init', 'Could not initialize signing client. Wallet is required.');
}
else {
throw new SpVuexError('TxClient:MsgApproveLoan:Send', 'Could not broadcast Tx: ' + e.message);
}
}
},
async sendMsgRepayLoan({ rootGetters }, { value, fee = [], memo = '' }) {
try {
const txClient = await initTxClient(rootGetters);
const msg = await txClient.msgRepayLoan(value);
const result = await txClient.signAndBroadcast([msg], { fee: { amount: fee,
gas: "200000" }, memo });
return result;
}
catch (e) {
if (e == MissingWalletError) {
throw new SpVuexError('TxClient:MsgRepayLoan:Init', 'Could not initialize signing client. Wallet is required.');
}
else {
throw new SpVuexError('TxClient:MsgRepayLoan:Send', 'Could not broadcast Tx: ' + e.message);
}
}
},
async sendMsgLiquidateLoan({ rootGetters }, { value, fee = [], memo = '' }) {
try {
const txClient = await initTxClient(rootGetters);
const msg = await txClient.msgLiquidateLoan(value);
const result = await txClient.signAndBroadcast([msg], { fee: { amount: fee,
gas: "200000" }, memo });
return result;
}
catch (e) {
if (e == MissingWalletError) {
throw new SpVuexError('TxClient:MsgLiquidateLoan:Init', 'Could not initialize signing client. Wallet is required.');
}
else {
throw new SpVuexError('TxClient:MsgLiquidateLoan:Send', 'Could not broadcast Tx: ' + e.message);
}
}
},
async sendMsgRequestLoan({ rootGetters }, { value, fee = [], memo = '' }) {
try {
const txClient = await initTxClient(rootGetters);
const msg = await txClient.msgRequestLoan(value);
const result = await txClient.signAndBroadcast([msg], { fee: { amount: fee,
gas: "200000" }, memo });
return result;
}
catch (e) {
if (e == MissingWalletError) {
throw new SpVuexError('TxClient:MsgRequestLoan:Init', 'Could not initialize signing client. Wallet is required.');
}
else {
throw new SpVuexError('TxClient:MsgRequestLoan:Send', 'Could not broadcast Tx: ' + e.message);
}
}
},
async sendMsgCancelLoan({ rootGetters }, { value, fee = [], memo = '' }) {
try {
const txClient = await initTxClient(rootGetters);
const msg = await txClient.msgCancelLoan(value);
const result = await txClient.signAndBroadcast([msg], { fee: { amount: fee,
gas: "200000" }, memo });
return result;
}
catch (e) {
if (e == MissingWalletError) {
throw new SpVuexError('TxClient:MsgCancelLoan:Init', 'Could not initialize signing client. Wallet is required.');
}
else {
throw new SpVuexError('TxClient:MsgCancelLoan:Send', 'Could not broadcast Tx: ' + e.message);
}
}
},
async MsgApproveLoan({ rootGetters }, { value }) {
try {
const txClient = await initTxClient(rootGetters);
const msg = await txClient.msgApproveLoan(value);
return msg;
}
catch (e) {
if (e == MissingWalletError) {
throw new SpVuexError('TxClient:MsgApproveLoan:Init', 'Could not initialize signing client. Wallet is required.');
}
else {
throw new SpVuexError('TxClient:MsgApproveLoan:Create', 'Could not create message: ' + e.message);
}
}
},
async MsgRepayLoan({ rootGetters }, { value }) {
try {
const txClient = await initTxClient(rootGetters);
const msg = await txClient.msgRepayLoan(value);
return msg;
}
catch (e) {
if (e == MissingWalletError) {
throw new SpVuexError('TxClient:MsgRepayLoan:Init', 'Could not initialize signing client. Wallet is required.');
}
else {
throw new SpVuexError('TxClient:MsgRepayLoan:Create', 'Could not create message: ' + e.message);
}
}
},
async MsgLiquidateLoan({ rootGetters }, { value }) {
try {
const txClient = await initTxClient(rootGetters);
const msg = await txClient.msgLiquidateLoan(value);
return msg;
}
catch (e) {
if (e == MissingWalletError) {
throw new SpVuexError('TxClient:MsgLiquidateLoan:Init', 'Could not initialize signing client. Wallet is required.');
}
else {
throw new SpVuexError('TxClient:MsgLiquidateLoan:Create', 'Could not create message: ' + e.message);
}
}
},
async MsgRequestLoan({ rootGetters }, { value }) {
try {
const txClient = await initTxClient(rootGetters);
const msg = await txClient.msgRequestLoan(value);
return msg;
}
catch (e) {
if (e == MissingWalletError) {
throw new SpVuexError('TxClient:MsgRequestLoan:Init', 'Could not initialize signing client. Wallet is required.');
}
else {
throw new SpVuexError('TxClient:MsgRequestLoan:Create', 'Could not create message: ' + e.message);
}
}
},
async MsgCancelLoan({ rootGetters }, { value }) {
try {
const txClient = await initTxClient(rootGetters);
const msg = await txClient.msgCancelLoan(value);
return msg;
}
catch (e) {
if (e == MissingWalletError) {
throw new SpVuexError('TxClient:MsgCancelLoan:Init', 'Could not initialize signing client. Wallet is required.');
}
else {
throw new SpVuexError('TxClient:MsgCancelLoan:Create', 'Could not create message: ' + e.message);
}
}
},
}
};
Loading

0 comments on commit f87ed32

Please sign in to comment.