Skip to content

Commit

Permalink
fix module name in app.go and remove import duplicated file in app.go
Browse files Browse the repository at this point in the history
  • Loading branch information
dDeedev committed Sep 23, 2022
1 parent 3f98053 commit 851ddab
Show file tree
Hide file tree
Showing 35 changed files with 6,778 additions and 149 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@
.DS_Store
.vscode/
test/*
ts-client/*
ts-client/*
vue/node_modules/
4 changes: 1 addition & 3 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import (
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/cosmos/cosmos-sdk/x/auth/ante"

admintypes "github.com/thesixnetwork/sixnft/x/admin/types"

authrest "github.com/cosmos/cosmos-sdk/x/auth/client/rest"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation"
Expand Down Expand Up @@ -185,7 +183,7 @@ var (
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
govtypes.ModuleName: {authtypes.Burner},
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
admintypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking},
adminmoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking},
// this line is used by starport scaffolding # stargate/app/maccPerms
}
)
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ require (
github.com/goccy/go-yaml v1.9.4 // indirect
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
github.com/gogo/gateway v1.1.0 // indirect
github.com/golang/glog v1.0.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/snappy v0.0.3 // indirect
github.com/google/btree v1.0.0 // indirect
Expand All @@ -89,6 +90,7 @@ require (
github.com/gorilla/handlers v1.5.1 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3 // indirect
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
github.com/gtank/merlin v0.1.1 // indirect
github.com/gtank/ristretto255 v0.1.2 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,8 @@ github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2V
github.com/golang-sql/sqlexp v0.0.0-20170517235910-f1bb20e5a188/go.mod h1:vXjM/+wXQnTPR4KqTKDgJukSZ6amVRtWMPEjE6sQoK8=
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
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 @@ -734,6 +736,8 @@ github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t
github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
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.11.3 h1:lLT7ZLSzGLI08vc9cpd+tYmNWjdKDqyr/2L+f6U12Fk=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3/go.mod h1:o//XUCC/F+yRGJoPO/VU0GSB0f8Nhgmxx0VIRUvaC0w=
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
2 changes: 1 addition & 1 deletion vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"@starport/vuex": "^0.3.5",
"buffer": "^6.0.3",
"core-js": "^3.18.2",
"sixnft-client-ts": "file:../ts-client",
"thesixnetwork-sixnft-client-ts": "file:../ts-client",
"vue": "^3.2.6",
"vue-router": "^4.0.3",
"vuex": "^4.0.2"
Expand Down
200 changes: 200 additions & 0 deletions vue/src/store/generated/cosmos.auth.v1beta1/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
import { Client, registry, MissingWalletError } from 'thesixnetwork-sixnft-client-ts'

import { BaseAccount } from "thesixnetwork-sixnft-client-ts/cosmos.auth.v1beta1/types"
import { ModuleAccount } from "thesixnetwork-sixnft-client-ts/cosmos.auth.v1beta1/types"
import { Params } from "thesixnetwork-sixnft-client-ts/cosmos.auth.v1beta1/types"


export { BaseAccount, ModuleAccount, Params };

function initClient(vuexGetters) {
return new Client(vuexGetters['common/env/getEnv'], vuexGetters['common/wallet/signer'])
}

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
}

type Field = {
name: string;
type: unknown;
}
function getStructure(template) {
let structure: {fields: Field[]} = { fields: [] }
for (const [key, value] of Object.entries(template)) {
let field = { name: key, type: typeof value }
structure.fields.push(field)
}
return structure
}
const getDefaultState = () => {
return {
Accounts: {},
Account: {},
Params: {},

_Structure: {
BaseAccount: getStructure(BaseAccount.fromPartial({})),
ModuleAccount: getStructure(ModuleAccount.fromPartial({})),
Params: getStructure(Params.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: {
getAccounts: (state) => (params = { params: {}}) => {
if (!(<any> params).query) {
(<any> params).query=null
}
return state.Accounts[JSON.stringify(params)] ?? {}
},
getAccount: (state) => (params = { params: {}}) => {
if (!(<any> params).query) {
(<any> params).query=null
}
return state.Account[JSON.stringify(params)] ?? {}
},
getParams: (state) => (params = { params: {}}) => {
if (!(<any> params).query) {
(<any> params).query=null
}
return state.Params[JSON.stringify(params)] ?? {}
},

getTypeStructure: (state) => (type) => {
return state._Structure[type].fields
},
getRegistry: (state) => {
return state._Registry
}
},
actions: {
init({ dispatch, rootGetters }) {
console.log('Vuex module: cosmos.auth.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 Error('Subscriptions: ' + e.message)
}
})
},






async QueryAccounts({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) {
try {
const key = params ?? {};
const client = initClient(rootGetters);
let value= (await client.CosmosAuthV1Beta1.query.queryAccounts(query ?? undefined)).data


while (all && (<any> value).pagination && (<any> value).pagination.next_key!=null) {
let next_values=(await client.CosmosAuthV1Beta1.query.queryAccounts({...query ?? {}, 'pagination.key':(<any> value).pagination.next_key} as any)).data
value = mergeResults(value, next_values);
}
commit('QUERY', { query: 'Accounts', key: { params: {...key}, query}, value })
if (subscribe) commit('SUBSCRIBE', { action: 'QueryAccounts', payload: { options: { all }, params: {...key},query }})
return getters['getAccounts']( { params: {...key}, query}) ?? {}
} catch (e) {
throw new Error('QueryClient:QueryAccounts API Node Unavailable. Could not perform query: ' + e.message)

}
},







async QueryAccount({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) {
try {
const key = params ?? {};
const client = initClient(rootGetters);
let value= (await client.CosmosAuthV1Beta1.query.queryAccount( key.address)).data


commit('QUERY', { query: 'Account', key: { params: {...key}, query}, value })
if (subscribe) commit('SUBSCRIBE', { action: 'QueryAccount', payload: { options: { all }, params: {...key},query }})
return getters['getAccount']( { params: {...key}, query}) ?? {}
} catch (e) {
throw new Error('QueryClient:QueryAccount API Node Unavailable. Could not perform query: ' + e.message)

}
},







async QueryParams({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) {
try {
const key = params ?? {};
const client = initClient(rootGetters);
let value= (await client.CosmosAuthV1Beta1.query.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 Error('QueryClient:QueryParams API Node Unavailable. Could not perform query: ' + e.message)

}
},




}
}
Loading

0 comments on commit 851ddab

Please sign in to comment.