remove vue interface
parent
e219d2f42c
commit
3ef4eddc7e
|
@ -1,25 +0,0 @@
|
||||||
## App UI Template
|
|
||||||
|
|
||||||
[Vue.js](https://vuejs.org/)-based web app template for your Cosmos SDK blockchain. Use the template to quickly bootstrap your app. To learn more, check out the components in `@starport/vue` and the [Starport documentation](https://docs.starport.network/).
|
|
||||||
|
|
||||||
## Project setup
|
|
||||||
|
|
||||||
```
|
|
||||||
npm install
|
|
||||||
```
|
|
||||||
|
|
||||||
### Compiles and reloads the app on save for development
|
|
||||||
|
|
||||||
```
|
|
||||||
npm run dev
|
|
||||||
```
|
|
||||||
|
|
||||||
### Compiles and minifies for production
|
|
||||||
|
|
||||||
```
|
|
||||||
npm run build
|
|
||||||
```
|
|
||||||
|
|
||||||
### Customize configuration
|
|
||||||
|
|
||||||
See [Configuration Reference](https://cli.vuejs.org/config/).
|
|
|
@ -1,19 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
|
|
||||||
<title> </title>
|
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" />
|
|
||||||
<link
|
|
||||||
href="https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap"
|
|
||||||
rel="stylesheet"
|
|
||||||
/>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div id="app"></div>
|
|
||||||
<script type="module" src="/src/main.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,34 +0,0 @@
|
||||||
{
|
|
||||||
"name": "@starport/template",
|
|
||||||
"version": "0.3.5",
|
|
||||||
"description": "A Vue 3 boilerplate project utilizing @starport/vue and @starport/vuex",
|
|
||||||
"author": "Tendermint, Inc <hello@tendermint.com>",
|
|
||||||
"private": true,
|
|
||||||
"scripts": {
|
|
||||||
"dev": "vite",
|
|
||||||
"build": "vite build",
|
|
||||||
"serve": "vite preview"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@cosmjs/launchpad": "0.27.0",
|
|
||||||
"@cosmjs/proto-signing": "0.27.0",
|
|
||||||
"@cosmjs/stargate": "0.27.0",
|
|
||||||
"@starport/vue": "^0.3.5",
|
|
||||||
"@starport/vuex": "^0.3.5",
|
|
||||||
"buffer": "^6.0.3",
|
|
||||||
"core-js": "^3.18.2",
|
|
||||||
"vue": "^3.2.6",
|
|
||||||
"vue-router": "^4.0.3",
|
|
||||||
"vuex": "^4.0.2"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@rollup/plugin-commonjs": "^21.0.1",
|
|
||||||
"@rollup/plugin-dynamic-import-vars": "^1.4.1",
|
|
||||||
"@rollup/plugin-node-resolve": "^13.1.1",
|
|
||||||
"@vitejs/plugin-vue": "^2.0.1",
|
|
||||||
"sass": "^1.47.0",
|
|
||||||
"vite": "^2.7.6",
|
|
||||||
"vite-plugin-dynamic-import": "^0.1.1",
|
|
||||||
"vite-plugin-env-compatible": "^1.1.1"
|
|
||||||
}
|
|
||||||
}
|
|
Binary file not shown.
Before Width: | Height: | Size: 4.2 KiB |
|
@ -1,60 +0,0 @@
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
<SpTheme>
|
|
||||||
<SpNavbar
|
|
||||||
:links="navbarLinks"
|
|
||||||
:active-route="router.currentRoute.value.path"
|
|
||||||
/>
|
|
||||||
<router-view />
|
|
||||||
</SpTheme>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
import { SpNavbar, SpTheme } from '@starport/vue'
|
|
||||||
import { computed, onBeforeMount } from 'vue'
|
|
||||||
import { useRouter } from 'vue-router'
|
|
||||||
import { useStore } from 'vuex'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
components: { SpTheme, SpNavbar },
|
|
||||||
|
|
||||||
setup() {
|
|
||||||
// store
|
|
||||||
let $s = useStore()
|
|
||||||
|
|
||||||
// router
|
|
||||||
let router = useRouter()
|
|
||||||
|
|
||||||
// state
|
|
||||||
let navbarLinks = [
|
|
||||||
{ name: 'Portfolio', url: '/portfolio' },
|
|
||||||
{ name: 'Data', url: '/data' }
|
|
||||||
]
|
|
||||||
|
|
||||||
// computed
|
|
||||||
let address = computed(() => $s.getters['common/wallet/address'])
|
|
||||||
|
|
||||||
// lh
|
|
||||||
onBeforeMount(async () => {
|
|
||||||
await $s.dispatch('common/env/init')
|
|
||||||
|
|
||||||
router.push('portfolio')
|
|
||||||
})
|
|
||||||
|
|
||||||
return {
|
|
||||||
navbarLinks,
|
|
||||||
// router
|
|
||||||
router,
|
|
||||||
// computed
|
|
||||||
address
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped lang="scss">
|
|
||||||
body {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
</style>
|
|
|
@ -1,9 +0,0 @@
|
||||||
import starportLibrary from '@starport/vue'
|
|
||||||
import { createApp } from 'vue'
|
|
||||||
|
|
||||||
import App from './App.vue'
|
|
||||||
import router from './router'
|
|
||||||
import store from './store'
|
|
||||||
|
|
||||||
const app = createApp(App)
|
|
||||||
app.use(store).use(router).use(starportLibrary).mount('#app')
|
|
|
@ -1,18 +0,0 @@
|
||||||
import { createRouter, createWebHistory } from 'vue-router'
|
|
||||||
|
|
||||||
import Data from '../views/Data.vue'
|
|
||||||
import Portfolio from '../views/Portfolio.vue'
|
|
||||||
|
|
||||||
const routerHistory = createWebHistory()
|
|
||||||
const routes = [
|
|
||||||
{ path: '/', component: Portfolio },
|
|
||||||
{ path: '/portfolio', component: Portfolio },
|
|
||||||
{ path: '/data', component: Data }
|
|
||||||
]
|
|
||||||
|
|
||||||
const router = createRouter({
|
|
||||||
history: routerHistory,
|
|
||||||
routes
|
|
||||||
})
|
|
||||||
|
|
||||||
export default router
|
|
|
@ -1,11 +0,0 @@
|
||||||
import { blocks, env, wallet } from '@starport/vuex'
|
|
||||||
|
|
||||||
import generated from './generated'
|
|
||||||
export default function init(store) {
|
|
||||||
for (const moduleInit of Object.values(generated)) {
|
|
||||||
moduleInit(store)
|
|
||||||
}
|
|
||||||
blocks(store)
|
|
||||||
env(store)
|
|
||||||
wallet(store)
|
|
||||||
}
|
|
|
@ -1,294 +0,0 @@
|
||||||
import { txClient, queryClient, MissingWalletError , registry} from './module'
|
|
||||||
|
|
||||||
import { Auction } from "./module/types/cosmostest/auction"
|
|
||||||
import { Bid } from "./module/types/cosmostest/bid"
|
|
||||||
import { NextAuction } from "./module/types/cosmostest/next_auction"
|
|
||||||
import { Params } from "./module/types/cosmostest/params"
|
|
||||||
|
|
||||||
|
|
||||||
export { Auction, Bid, NextAuction, Params };
|
|
||||||
|
|
||||||
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: {},
|
|
||||||
NextAuction: {},
|
|
||||||
Auction: {},
|
|
||||||
AuctionAll: {},
|
|
||||||
|
|
||||||
_Structure: {
|
|
||||||
Auction: getStructure(Auction.fromPartial({})),
|
|
||||||
Bid: getStructure(Bid.fromPartial({})),
|
|
||||||
NextAuction: getStructure(NextAuction.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: {
|
|
||||||
getParams: (state) => (params = { params: {}}) => {
|
|
||||||
if (!(<any> params).query) {
|
|
||||||
(<any> params).query=null
|
|
||||||
}
|
|
||||||
return state.Params[JSON.stringify(params)] ?? {}
|
|
||||||
},
|
|
||||||
getNextAuction: (state) => (params = { params: {}}) => {
|
|
||||||
if (!(<any> params).query) {
|
|
||||||
(<any> params).query=null
|
|
||||||
}
|
|
||||||
return state.NextAuction[JSON.stringify(params)] ?? {}
|
|
||||||
},
|
|
||||||
getAuction: (state) => (params = { params: {}}) => {
|
|
||||||
if (!(<any> params).query) {
|
|
||||||
(<any> params).query=null
|
|
||||||
}
|
|
||||||
return state.Auction[JSON.stringify(params)] ?? {}
|
|
||||||
},
|
|
||||||
getAuctionAll: (state) => (params = { params: {}}) => {
|
|
||||||
if (!(<any> params).query) {
|
|
||||||
(<any> params).query=null
|
|
||||||
}
|
|
||||||
return state.AuctionAll[JSON.stringify(params)] ?? {}
|
|
||||||
},
|
|
||||||
|
|
||||||
getTypeStructure: (state) => (type) => {
|
|
||||||
return state._Structure[type].fields
|
|
||||||
},
|
|
||||||
getRegistry: (state) => {
|
|
||||||
return state._Registry
|
|
||||||
}
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
init({ dispatch, rootGetters }) {
|
|
||||||
console.log('Vuex module: cosmostest.cosmostest 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 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 Error('QueryClient:QueryParams API Node Unavailable. Could not perform query: ' + e.message)
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async QueryNextAuction({ 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.queryNextAuction()).data
|
|
||||||
|
|
||||||
|
|
||||||
commit('QUERY', { query: 'NextAuction', key: { params: {...key}, query}, value })
|
|
||||||
if (subscribe) commit('SUBSCRIBE', { action: 'QueryNextAuction', payload: { options: { all }, params: {...key},query }})
|
|
||||||
return getters['getNextAuction']( { params: {...key}, query}) ?? {}
|
|
||||||
} catch (e) {
|
|
||||||
throw new Error('QueryClient:QueryNextAuction API Node Unavailable. Could not perform query: ' + e.message)
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async QueryAuction({ 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.queryAuction( key.index)).data
|
|
||||||
|
|
||||||
|
|
||||||
commit('QUERY', { query: 'Auction', key: { params: {...key}, query}, value })
|
|
||||||
if (subscribe) commit('SUBSCRIBE', { action: 'QueryAuction', payload: { options: { all }, params: {...key},query }})
|
|
||||||
return getters['getAuction']( { params: {...key}, query}) ?? {}
|
|
||||||
} catch (e) {
|
|
||||||
throw new Error('QueryClient:QueryAuction API Node Unavailable. Could not perform query: ' + e.message)
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async QueryAuctionAll({ 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.queryAuctionAll(query)).data
|
|
||||||
|
|
||||||
|
|
||||||
while (all && (<any> value).pagination && (<any> value).pagination.next_key!=null) {
|
|
||||||
let next_values=(await queryClient.queryAuctionAll({...query, 'pagination.key':(<any> value).pagination.next_key})).data
|
|
||||||
value = mergeResults(value, next_values);
|
|
||||||
}
|
|
||||||
commit('QUERY', { query: 'AuctionAll', key: { params: {...key}, query}, value })
|
|
||||||
if (subscribe) commit('SUBSCRIBE', { action: 'QueryAuctionAll', payload: { options: { all }, params: {...key},query }})
|
|
||||||
return getters['getAuctionAll']( { params: {...key}, query}) ?? {}
|
|
||||||
} catch (e) {
|
|
||||||
throw new Error('QueryClient:QueryAuctionAll API Node Unavailable. Could not perform query: ' + e.message)
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
async sendMsgNewBid({ rootGetters }, { value, fee = [], memo = '' }) {
|
|
||||||
try {
|
|
||||||
const txClient=await initTxClient(rootGetters)
|
|
||||||
const msg = await txClient.msgNewBid(value)
|
|
||||||
const result = await txClient.signAndBroadcast([msg], {fee: { amount: fee,
|
|
||||||
gas: "200000" }, memo})
|
|
||||||
return result
|
|
||||||
} catch (e) {
|
|
||||||
if (e == MissingWalletError) {
|
|
||||||
throw new Error('TxClient:MsgNewBid:Init Could not initialize signing client. Wallet is required.')
|
|
||||||
}else{
|
|
||||||
throw new Error('TxClient:MsgNewBid:Send Could not broadcast Tx: '+ e.message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async sendMsgNewAuction({ rootGetters }, { value, fee = [], memo = '' }) {
|
|
||||||
try {
|
|
||||||
const txClient=await initTxClient(rootGetters)
|
|
||||||
const msg = await txClient.msgNewAuction(value)
|
|
||||||
const result = await txClient.signAndBroadcast([msg], {fee: { amount: fee,
|
|
||||||
gas: "200000" }, memo})
|
|
||||||
return result
|
|
||||||
} catch (e) {
|
|
||||||
if (e == MissingWalletError) {
|
|
||||||
throw new Error('TxClient:MsgNewAuction:Init Could not initialize signing client. Wallet is required.')
|
|
||||||
}else{
|
|
||||||
throw new Error('TxClient:MsgNewAuction:Send Could not broadcast Tx: '+ e.message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
async MsgNewBid({ rootGetters }, { value }) {
|
|
||||||
try {
|
|
||||||
const txClient=await initTxClient(rootGetters)
|
|
||||||
const msg = await txClient.msgNewBid(value)
|
|
||||||
return msg
|
|
||||||
} catch (e) {
|
|
||||||
if (e == MissingWalletError) {
|
|
||||||
throw new Error('TxClient:MsgNewBid:Init Could not initialize signing client. Wallet is required.')
|
|
||||||
} else{
|
|
||||||
throw new Error('TxClient:MsgNewBid:Create Could not create message: ' + e.message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async MsgNewAuction({ rootGetters }, { value }) {
|
|
||||||
try {
|
|
||||||
const txClient=await initTxClient(rootGetters)
|
|
||||||
const msg = await txClient.msgNewAuction(value)
|
|
||||||
return msg
|
|
||||||
} catch (e) {
|
|
||||||
if (e == MissingWalletError) {
|
|
||||||
throw new Error('TxClient:MsgNewAuction:Init Could not initialize signing client. Wallet is required.')
|
|
||||||
} else{
|
|
||||||
throw new Error('TxClient:MsgNewAuction:Create Could not create message: ' + e.message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,63 +0,0 @@
|
||||||
// THIS FILE IS GENERATED AUTOMATICALLY. DO NOT MODIFY.
|
|
||||||
|
|
||||||
import { StdFee } from "@cosmjs/launchpad";
|
|
||||||
import { SigningStargateClient } from "@cosmjs/stargate";
|
|
||||||
import { Registry, OfflineSigner, EncodeObject, DirectSecp256k1HdWallet } from "@cosmjs/proto-signing";
|
|
||||||
import { Api } from "./rest";
|
|
||||||
import { MsgNewBid } from "./types/cosmostest/tx";
|
|
||||||
import { MsgNewAuction } from "./types/cosmostest/tx";
|
|
||||||
|
|
||||||
|
|
||||||
const types = [
|
|
||||||
["/cosmostest.cosmostest.MsgNewBid", MsgNewBid],
|
|
||||||
["/cosmostest.cosmostest.MsgNewAuction", MsgNewAuction],
|
|
||||||
|
|
||||||
];
|
|
||||||
export const MissingWalletError = new Error("wallet is required");
|
|
||||||
|
|
||||||
export const registry = new Registry(<any>types);
|
|
||||||
|
|
||||||
const defaultFee = {
|
|
||||||
amount: [],
|
|
||||||
gas: "200000",
|
|
||||||
};
|
|
||||||
|
|
||||||
interface TxClientOptions {
|
|
||||||
addr: string
|
|
||||||
}
|
|
||||||
|
|
||||||
interface SignAndBroadcastOptions {
|
|
||||||
fee: StdFee,
|
|
||||||
memo?: string
|
|
||||||
}
|
|
||||||
|
|
||||||
const txClient = async (wallet: OfflineSigner, { addr: addr }: TxClientOptions = { addr: "http://localhost:26657" }) => {
|
|
||||||
if (!wallet) throw MissingWalletError;
|
|
||||||
let client;
|
|
||||||
if (addr) {
|
|
||||||
client = await SigningStargateClient.connectWithSigner(addr, wallet, { registry });
|
|
||||||
}else{
|
|
||||||
client = await SigningStargateClient.offline( wallet, { registry });
|
|
||||||
}
|
|
||||||
const { address } = (await wallet.getAccounts())[0];
|
|
||||||
|
|
||||||
return {
|
|
||||||
signAndBroadcast: (msgs: EncodeObject[], { fee, memo }: SignAndBroadcastOptions = {fee: defaultFee, memo: ""}) => client.signAndBroadcast(address, msgs, fee,memo),
|
|
||||||
msgNewBid: (data: MsgNewBid): EncodeObject => ({ typeUrl: "/cosmostest.cosmostest.MsgNewBid", value: MsgNewBid.fromPartial( data ) }),
|
|
||||||
msgNewAuction: (data: MsgNewAuction): EncodeObject => ({ typeUrl: "/cosmostest.cosmostest.MsgNewAuction", value: MsgNewAuction.fromPartial( data ) }),
|
|
||||||
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
interface QueryClientOptions {
|
|
||||||
addr: string
|
|
||||||
}
|
|
||||||
|
|
||||||
const queryClient = async ({ addr: addr }: QueryClientOptions = { addr: "http://localhost:1317" }) => {
|
|
||||||
return new Api({ baseUrl: addr });
|
|
||||||
};
|
|
||||||
|
|
||||||
export {
|
|
||||||
txClient,
|
|
||||||
queryClient,
|
|
||||||
};
|
|
|
@ -1,406 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
/* tslint:disable */
|
|
||||||
/*
|
|
||||||
* ---------------------------------------------------------------
|
|
||||||
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
|
|
||||||
* ## ##
|
|
||||||
* ## AUTHOR: acacode ##
|
|
||||||
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
|
|
||||||
* ---------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
export interface CosmostestAuction {
|
|
||||||
index?: string;
|
|
||||||
name?: string;
|
|
||||||
description?: string;
|
|
||||||
bids?: CosmostestBid[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CosmostestBid {
|
|
||||||
owner?: string;
|
|
||||||
amount?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CosmostestMsgNewAuctionResponse {
|
|
||||||
auctionId?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type CosmostestMsgNewBidResponse = object;
|
|
||||||
|
|
||||||
export interface CosmostestNextAuction {
|
|
||||||
/** @format uint64 */
|
|
||||||
auctionId?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Params defines the parameters for the module.
|
|
||||||
*/
|
|
||||||
export type CosmostestParams = object;
|
|
||||||
|
|
||||||
export interface CosmostestQueryAllAuctionResponse {
|
|
||||||
auction?: CosmostestAuction[];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PageResponse is to be embedded in gRPC response messages where the
|
|
||||||
* corresponding request message has used PageRequest.
|
|
||||||
*
|
|
||||||
* message SomeResponse {
|
|
||||||
* repeated Bar results = 1;
|
|
||||||
* PageResponse page = 2;
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
pagination?: V1Beta1PageResponse;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CosmostestQueryGetAuctionResponse {
|
|
||||||
auction?: CosmostestAuction;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CosmostestQueryGetNextAuctionResponse {
|
|
||||||
NextAuction?: CosmostestNextAuction;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* QueryParamsResponse is response type for the Query/Params RPC method.
|
|
||||||
*/
|
|
||||||
export interface CosmostestQueryParamsResponse {
|
|
||||||
/** params holds all the parameters of this module. */
|
|
||||||
params?: CosmostestParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ProtobufAny {
|
|
||||||
"@type"?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface RpcStatus {
|
|
||||||
/** @format int32 */
|
|
||||||
code?: number;
|
|
||||||
message?: string;
|
|
||||||
details?: ProtobufAny[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* message SomeRequest {
|
|
||||||
Foo some_parameter = 1;
|
|
||||||
PageRequest pagination = 2;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
export interface V1Beta1PageRequest {
|
|
||||||
/**
|
|
||||||
* key is a value returned in PageResponse.next_key to begin
|
|
||||||
* querying the next page most efficiently. Only one of offset or key
|
|
||||||
* should be set.
|
|
||||||
* @format byte
|
|
||||||
*/
|
|
||||||
key?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* offset is a numeric offset that can be used when key is unavailable.
|
|
||||||
* It is less efficient than using key. Only one of offset or key should
|
|
||||||
* be set.
|
|
||||||
* @format uint64
|
|
||||||
*/
|
|
||||||
offset?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* limit is the total number of results to be returned in the result page.
|
|
||||||
* If left empty it will default to a value to be set by each app.
|
|
||||||
* @format uint64
|
|
||||||
*/
|
|
||||||
limit?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* count_total is set to true to indicate that the result set should include
|
|
||||||
* a count of the total number of items available for pagination in UIs.
|
|
||||||
* count_total is only respected when offset is used. It is ignored when key
|
|
||||||
* is set.
|
|
||||||
*/
|
|
||||||
count_total?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PageResponse is to be embedded in gRPC response messages where the
|
|
||||||
corresponding request message has used PageRequest.
|
|
||||||
|
|
||||||
message SomeResponse {
|
|
||||||
repeated Bar results = 1;
|
|
||||||
PageResponse page = 2;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
export interface V1Beta1PageResponse {
|
|
||||||
/** @format byte */
|
|
||||||
next_key?: string;
|
|
||||||
|
|
||||||
/** @format uint64 */
|
|
||||||
total?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type QueryParamsType = Record<string | number, any>;
|
|
||||||
export type ResponseFormat = keyof Omit<Body, "body" | "bodyUsed">;
|
|
||||||
|
|
||||||
export interface FullRequestParams extends Omit<RequestInit, "body"> {
|
|
||||||
/** set parameter to `true` for call `securityWorker` for this request */
|
|
||||||
secure?: boolean;
|
|
||||||
/** request path */
|
|
||||||
path: string;
|
|
||||||
/** content type of request body */
|
|
||||||
type?: ContentType;
|
|
||||||
/** query params */
|
|
||||||
query?: QueryParamsType;
|
|
||||||
/** format of response (i.e. response.json() -> format: "json") */
|
|
||||||
format?: keyof Omit<Body, "body" | "bodyUsed">;
|
|
||||||
/** request body */
|
|
||||||
body?: unknown;
|
|
||||||
/** base url */
|
|
||||||
baseUrl?: string;
|
|
||||||
/** request cancellation token */
|
|
||||||
cancelToken?: CancelToken;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type RequestParams = Omit<FullRequestParams, "body" | "method" | "query" | "path">;
|
|
||||||
|
|
||||||
export interface ApiConfig<SecurityDataType = unknown> {
|
|
||||||
baseUrl?: string;
|
|
||||||
baseApiParams?: Omit<RequestParams, "baseUrl" | "cancelToken" | "signal">;
|
|
||||||
securityWorker?: (securityData: SecurityDataType) => RequestParams | void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
|
|
||||||
data: D;
|
|
||||||
error: E;
|
|
||||||
}
|
|
||||||
|
|
||||||
type CancelToken = Symbol | string | number;
|
|
||||||
|
|
||||||
export enum ContentType {
|
|
||||||
Json = "application/json",
|
|
||||||
FormData = "multipart/form-data",
|
|
||||||
UrlEncoded = "application/x-www-form-urlencoded",
|
|
||||||
}
|
|
||||||
|
|
||||||
export class HttpClient<SecurityDataType = unknown> {
|
|
||||||
public baseUrl: string = "";
|
|
||||||
private securityData: SecurityDataType = null as any;
|
|
||||||
private securityWorker: null | ApiConfig<SecurityDataType>["securityWorker"] = null;
|
|
||||||
private abortControllers = new Map<CancelToken, AbortController>();
|
|
||||||
|
|
||||||
private baseApiParams: RequestParams = {
|
|
||||||
credentials: "same-origin",
|
|
||||||
headers: {},
|
|
||||||
redirect: "follow",
|
|
||||||
referrerPolicy: "no-referrer",
|
|
||||||
};
|
|
||||||
|
|
||||||
constructor(apiConfig: ApiConfig<SecurityDataType> = {}) {
|
|
||||||
Object.assign(this, apiConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
public setSecurityData = (data: SecurityDataType) => {
|
|
||||||
this.securityData = data;
|
|
||||||
};
|
|
||||||
|
|
||||||
private addQueryParam(query: QueryParamsType, key: string) {
|
|
||||||
const value = query[key];
|
|
||||||
|
|
||||||
return (
|
|
||||||
encodeURIComponent(key) +
|
|
||||||
"=" +
|
|
||||||
encodeURIComponent(Array.isArray(value) ? value.join(",") : typeof value === "number" ? value : `${value}`)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected toQueryString(rawQuery?: QueryParamsType): string {
|
|
||||||
const query = rawQuery || {};
|
|
||||||
const keys = Object.keys(query).filter((key) => "undefined" !== typeof query[key]);
|
|
||||||
return keys
|
|
||||||
.map((key) =>
|
|
||||||
typeof query[key] === "object" && !Array.isArray(query[key])
|
|
||||||
? this.toQueryString(query[key] as QueryParamsType)
|
|
||||||
: this.addQueryParam(query, key),
|
|
||||||
)
|
|
||||||
.join("&");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected addQueryParams(rawQuery?: QueryParamsType): string {
|
|
||||||
const queryString = this.toQueryString(rawQuery);
|
|
||||||
return queryString ? `?${queryString}` : "";
|
|
||||||
}
|
|
||||||
|
|
||||||
private contentFormatters: Record<ContentType, (input: any) => any> = {
|
|
||||||
[ContentType.Json]: (input: any) =>
|
|
||||||
input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input,
|
|
||||||
[ContentType.FormData]: (input: any) =>
|
|
||||||
Object.keys(input || {}).reduce((data, key) => {
|
|
||||||
data.append(key, input[key]);
|
|
||||||
return data;
|
|
||||||
}, new FormData()),
|
|
||||||
[ContentType.UrlEncoded]: (input: any) => this.toQueryString(input),
|
|
||||||
};
|
|
||||||
|
|
||||||
private mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams {
|
|
||||||
return {
|
|
||||||
...this.baseApiParams,
|
|
||||||
...params1,
|
|
||||||
...(params2 || {}),
|
|
||||||
headers: {
|
|
||||||
...(this.baseApiParams.headers || {}),
|
|
||||||
...(params1.headers || {}),
|
|
||||||
...((params2 && params2.headers) || {}),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private createAbortSignal = (cancelToken: CancelToken): AbortSignal | undefined => {
|
|
||||||
if (this.abortControllers.has(cancelToken)) {
|
|
||||||
const abortController = this.abortControllers.get(cancelToken);
|
|
||||||
if (abortController) {
|
|
||||||
return abortController.signal;
|
|
||||||
}
|
|
||||||
return void 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const abortController = new AbortController();
|
|
||||||
this.abortControllers.set(cancelToken, abortController);
|
|
||||||
return abortController.signal;
|
|
||||||
};
|
|
||||||
|
|
||||||
public abortRequest = (cancelToken: CancelToken) => {
|
|
||||||
const abortController = this.abortControllers.get(cancelToken);
|
|
||||||
|
|
||||||
if (abortController) {
|
|
||||||
abortController.abort();
|
|
||||||
this.abortControllers.delete(cancelToken);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public request = <T = any, E = any>({
|
|
||||||
body,
|
|
||||||
secure,
|
|
||||||
path,
|
|
||||||
type,
|
|
||||||
query,
|
|
||||||
format = "json",
|
|
||||||
baseUrl,
|
|
||||||
cancelToken,
|
|
||||||
...params
|
|
||||||
}: FullRequestParams): Promise<HttpResponse<T, E>> => {
|
|
||||||
const secureParams = (secure && this.securityWorker && this.securityWorker(this.securityData)) || {};
|
|
||||||
const requestParams = this.mergeRequestParams(params, secureParams);
|
|
||||||
const queryString = query && this.toQueryString(query);
|
|
||||||
const payloadFormatter = this.contentFormatters[type || ContentType.Json];
|
|
||||||
|
|
||||||
return fetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, {
|
|
||||||
...requestParams,
|
|
||||||
headers: {
|
|
||||||
...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}),
|
|
||||||
...(requestParams.headers || {}),
|
|
||||||
},
|
|
||||||
signal: cancelToken ? this.createAbortSignal(cancelToken) : void 0,
|
|
||||||
body: typeof body === "undefined" || body === null ? null : payloadFormatter(body),
|
|
||||||
}).then(async (response) => {
|
|
||||||
const r = response as HttpResponse<T, E>;
|
|
||||||
r.data = (null as unknown) as T;
|
|
||||||
r.error = (null as unknown) as E;
|
|
||||||
|
|
||||||
const data = await response[format]()
|
|
||||||
.then((data) => {
|
|
||||||
if (r.ok) {
|
|
||||||
r.data = data;
|
|
||||||
} else {
|
|
||||||
r.error = data;
|
|
||||||
}
|
|
||||||
return r;
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
r.error = e;
|
|
||||||
return r;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (cancelToken) {
|
|
||||||
this.abortControllers.delete(cancelToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!response.ok) throw data;
|
|
||||||
return data;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @title cosmostest/auction.proto
|
|
||||||
* @version version not set
|
|
||||||
*/
|
|
||||||
export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
|
|
||||||
/**
|
|
||||||
* No description
|
|
||||||
*
|
|
||||||
* @tags Query
|
|
||||||
* @name QueryAuctionAll
|
|
||||||
* @summary Queries a list of Auction items.
|
|
||||||
* @request GET:/cosmos-test/cosmostest/auction
|
|
||||||
*/
|
|
||||||
queryAuctionAll = (
|
|
||||||
query?: {
|
|
||||||
"pagination.key"?: string;
|
|
||||||
"pagination.offset"?: string;
|
|
||||||
"pagination.limit"?: string;
|
|
||||||
"pagination.count_total"?: boolean;
|
|
||||||
},
|
|
||||||
params: RequestParams = {},
|
|
||||||
) =>
|
|
||||||
this.request<CosmostestQueryAllAuctionResponse, RpcStatus>({
|
|
||||||
path: `/cosmos-test/cosmostest/auction`,
|
|
||||||
method: "GET",
|
|
||||||
query: query,
|
|
||||||
format: "json",
|
|
||||||
...params,
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* No description
|
|
||||||
*
|
|
||||||
* @tags Query
|
|
||||||
* @name QueryAuction
|
|
||||||
* @summary Queries a Auction by index.
|
|
||||||
* @request GET:/cosmos-test/cosmostest/auction/{index}
|
|
||||||
*/
|
|
||||||
queryAuction = (index: string, params: RequestParams = {}) =>
|
|
||||||
this.request<CosmostestQueryGetAuctionResponse, RpcStatus>({
|
|
||||||
path: `/cosmos-test/cosmostest/auction/${index}`,
|
|
||||||
method: "GET",
|
|
||||||
format: "json",
|
|
||||||
...params,
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* No description
|
|
||||||
*
|
|
||||||
* @tags Query
|
|
||||||
* @name QueryNextAuction
|
|
||||||
* @summary Queries a NextAuction by index.
|
|
||||||
* @request GET:/cosmos-test/cosmostest/next_auction
|
|
||||||
*/
|
|
||||||
queryNextAuction = (params: RequestParams = {}) =>
|
|
||||||
this.request<CosmostestQueryGetNextAuctionResponse, RpcStatus>({
|
|
||||||
path: `/cosmos-test/cosmostest/next_auction`,
|
|
||||||
method: "GET",
|
|
||||||
format: "json",
|
|
||||||
...params,
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* No description
|
|
||||||
*
|
|
||||||
* @tags Query
|
|
||||||
* @name QueryParams
|
|
||||||
* @summary Parameters queries the parameters of the module.
|
|
||||||
* @request GET:/cosmos-test/cosmostest/params
|
|
||||||
*/
|
|
||||||
queryParams = (params: RequestParams = {}) =>
|
|
||||||
this.request<CosmostestQueryParamsResponse, RpcStatus>({
|
|
||||||
path: `/cosmos-test/cosmostest/params`,
|
|
||||||
method: "GET",
|
|
||||||
format: "json",
|
|
||||||
...params,
|
|
||||||
});
|
|
||||||
}
|
|
|
@ -1,300 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import * as Long from "long";
|
|
||||||
import { util, configure, Writer, Reader } from "protobufjs/minimal";
|
|
||||||
|
|
||||||
export const protobufPackage = "cosmos.base.query.v1beta1";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PageRequest is to be embedded in gRPC request messages for efficient
|
|
||||||
* pagination. Ex:
|
|
||||||
*
|
|
||||||
* message SomeRequest {
|
|
||||||
* Foo some_parameter = 1;
|
|
||||||
* PageRequest pagination = 2;
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
export interface PageRequest {
|
|
||||||
/**
|
|
||||||
* key is a value returned in PageResponse.next_key to begin
|
|
||||||
* querying the next page most efficiently. Only one of offset or key
|
|
||||||
* should be set.
|
|
||||||
*/
|
|
||||||
key: Uint8Array;
|
|
||||||
/**
|
|
||||||
* offset is a numeric offset that can be used when key is unavailable.
|
|
||||||
* It is less efficient than using key. Only one of offset or key should
|
|
||||||
* be set.
|
|
||||||
*/
|
|
||||||
offset: number;
|
|
||||||
/**
|
|
||||||
* limit is the total number of results to be returned in the result page.
|
|
||||||
* If left empty it will default to a value to be set by each app.
|
|
||||||
*/
|
|
||||||
limit: number;
|
|
||||||
/**
|
|
||||||
* count_total is set to true to indicate that the result set should include
|
|
||||||
* a count of the total number of items available for pagination in UIs.
|
|
||||||
* count_total is only respected when offset is used. It is ignored when key
|
|
||||||
* is set.
|
|
||||||
*/
|
|
||||||
count_total: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PageResponse is to be embedded in gRPC response messages where the
|
|
||||||
* corresponding request message has used PageRequest.
|
|
||||||
*
|
|
||||||
* message SomeResponse {
|
|
||||||
* repeated Bar results = 1;
|
|
||||||
* PageResponse page = 2;
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
export interface PageResponse {
|
|
||||||
/**
|
|
||||||
* next_key is the key to be passed to PageRequest.key to
|
|
||||||
* query the next page most efficiently
|
|
||||||
*/
|
|
||||||
next_key: Uint8Array;
|
|
||||||
/**
|
|
||||||
* total is total number of results available if PageRequest.count_total
|
|
||||||
* was set, its value is undefined otherwise
|
|
||||||
*/
|
|
||||||
total: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
const basePageRequest: object = { offset: 0, limit: 0, count_total: false };
|
|
||||||
|
|
||||||
export const PageRequest = {
|
|
||||||
encode(message: PageRequest, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.key.length !== 0) {
|
|
||||||
writer.uint32(10).bytes(message.key);
|
|
||||||
}
|
|
||||||
if (message.offset !== 0) {
|
|
||||||
writer.uint32(16).uint64(message.offset);
|
|
||||||
}
|
|
||||||
if (message.limit !== 0) {
|
|
||||||
writer.uint32(24).uint64(message.limit);
|
|
||||||
}
|
|
||||||
if (message.count_total === true) {
|
|
||||||
writer.uint32(32).bool(message.count_total);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): PageRequest {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...basePageRequest } as PageRequest;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.key = reader.bytes();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.offset = longToNumber(reader.uint64() as Long);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
message.limit = longToNumber(reader.uint64() as Long);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
message.count_total = reader.bool();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): PageRequest {
|
|
||||||
const message = { ...basePageRequest } as PageRequest;
|
|
||||||
if (object.key !== undefined && object.key !== null) {
|
|
||||||
message.key = bytesFromBase64(object.key);
|
|
||||||
}
|
|
||||||
if (object.offset !== undefined && object.offset !== null) {
|
|
||||||
message.offset = Number(object.offset);
|
|
||||||
} else {
|
|
||||||
message.offset = 0;
|
|
||||||
}
|
|
||||||
if (object.limit !== undefined && object.limit !== null) {
|
|
||||||
message.limit = Number(object.limit);
|
|
||||||
} else {
|
|
||||||
message.limit = 0;
|
|
||||||
}
|
|
||||||
if (object.count_total !== undefined && object.count_total !== null) {
|
|
||||||
message.count_total = Boolean(object.count_total);
|
|
||||||
} else {
|
|
||||||
message.count_total = false;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: PageRequest): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.key !== undefined &&
|
|
||||||
(obj.key = base64FromBytes(
|
|
||||||
message.key !== undefined ? message.key : new Uint8Array()
|
|
||||||
));
|
|
||||||
message.offset !== undefined && (obj.offset = message.offset);
|
|
||||||
message.limit !== undefined && (obj.limit = message.limit);
|
|
||||||
message.count_total !== undefined &&
|
|
||||||
(obj.count_total = message.count_total);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<PageRequest>): PageRequest {
|
|
||||||
const message = { ...basePageRequest } as PageRequest;
|
|
||||||
if (object.key !== undefined && object.key !== null) {
|
|
||||||
message.key = object.key;
|
|
||||||
} else {
|
|
||||||
message.key = new Uint8Array();
|
|
||||||
}
|
|
||||||
if (object.offset !== undefined && object.offset !== null) {
|
|
||||||
message.offset = object.offset;
|
|
||||||
} else {
|
|
||||||
message.offset = 0;
|
|
||||||
}
|
|
||||||
if (object.limit !== undefined && object.limit !== null) {
|
|
||||||
message.limit = object.limit;
|
|
||||||
} else {
|
|
||||||
message.limit = 0;
|
|
||||||
}
|
|
||||||
if (object.count_total !== undefined && object.count_total !== null) {
|
|
||||||
message.count_total = object.count_total;
|
|
||||||
} else {
|
|
||||||
message.count_total = false;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const basePageResponse: object = { total: 0 };
|
|
||||||
|
|
||||||
export const PageResponse = {
|
|
||||||
encode(message: PageResponse, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.next_key.length !== 0) {
|
|
||||||
writer.uint32(10).bytes(message.next_key);
|
|
||||||
}
|
|
||||||
if (message.total !== 0) {
|
|
||||||
writer.uint32(16).uint64(message.total);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): PageResponse {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...basePageResponse } as PageResponse;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.next_key = reader.bytes();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.total = longToNumber(reader.uint64() as Long);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): PageResponse {
|
|
||||||
const message = { ...basePageResponse } as PageResponse;
|
|
||||||
if (object.next_key !== undefined && object.next_key !== null) {
|
|
||||||
message.next_key = bytesFromBase64(object.next_key);
|
|
||||||
}
|
|
||||||
if (object.total !== undefined && object.total !== null) {
|
|
||||||
message.total = Number(object.total);
|
|
||||||
} else {
|
|
||||||
message.total = 0;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: PageResponse): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.next_key !== undefined &&
|
|
||||||
(obj.next_key = base64FromBytes(
|
|
||||||
message.next_key !== undefined ? message.next_key : new Uint8Array()
|
|
||||||
));
|
|
||||||
message.total !== undefined && (obj.total = message.total);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<PageResponse>): PageResponse {
|
|
||||||
const message = { ...basePageResponse } as PageResponse;
|
|
||||||
if (object.next_key !== undefined && object.next_key !== null) {
|
|
||||||
message.next_key = object.next_key;
|
|
||||||
} else {
|
|
||||||
message.next_key = new Uint8Array();
|
|
||||||
}
|
|
||||||
if (object.total !== undefined && object.total !== null) {
|
|
||||||
message.total = object.total;
|
|
||||||
} else {
|
|
||||||
message.total = 0;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
declare var self: any | undefined;
|
|
||||||
declare var window: any | undefined;
|
|
||||||
var globalThis: any = (() => {
|
|
||||||
if (typeof globalThis !== "undefined") return globalThis;
|
|
||||||
if (typeof self !== "undefined") return self;
|
|
||||||
if (typeof window !== "undefined") return window;
|
|
||||||
if (typeof global !== "undefined") return global;
|
|
||||||
throw "Unable to locate global object";
|
|
||||||
})();
|
|
||||||
|
|
||||||
const atob: (b64: string) => string =
|
|
||||||
globalThis.atob ||
|
|
||||||
((b64) => globalThis.Buffer.from(b64, "base64").toString("binary"));
|
|
||||||
function bytesFromBase64(b64: string): Uint8Array {
|
|
||||||
const bin = atob(b64);
|
|
||||||
const arr = new Uint8Array(bin.length);
|
|
||||||
for (let i = 0; i < bin.length; ++i) {
|
|
||||||
arr[i] = bin.charCodeAt(i);
|
|
||||||
}
|
|
||||||
return arr;
|
|
||||||
}
|
|
||||||
|
|
||||||
const btoa: (bin: string) => string =
|
|
||||||
globalThis.btoa ||
|
|
||||||
((bin) => globalThis.Buffer.from(bin, "binary").toString("base64"));
|
|
||||||
function base64FromBytes(arr: Uint8Array): string {
|
|
||||||
const bin: string[] = [];
|
|
||||||
for (let i = 0; i < arr.byteLength; ++i) {
|
|
||||||
bin.push(String.fromCharCode(arr[i]));
|
|
||||||
}
|
|
||||||
return btoa(bin.join(""));
|
|
||||||
}
|
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
||||||
export type DeepPartial<T> = T extends Builtin
|
|
||||||
? T
|
|
||||||
: T extends Array<infer U>
|
|
||||||
? Array<DeepPartial<U>>
|
|
||||||
: T extends ReadonlyArray<infer U>
|
|
||||||
? ReadonlyArray<DeepPartial<U>>
|
|
||||||
: T extends {}
|
|
||||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
||||||
: Partial<T>;
|
|
||||||
|
|
||||||
function longToNumber(long: Long): number {
|
|
||||||
if (long.gt(Number.MAX_SAFE_INTEGER)) {
|
|
||||||
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
|
||||||
}
|
|
||||||
return long.toNumber();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (util.Long !== Long) {
|
|
||||||
util.Long = Long as any;
|
|
||||||
configure();
|
|
||||||
}
|
|
|
@ -1,137 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import { Bid } from "../cosmostest/bid";
|
|
||||||
import { Writer, Reader } from "protobufjs/minimal";
|
|
||||||
|
|
||||||
export const protobufPackage = "cosmostest.cosmostest";
|
|
||||||
|
|
||||||
export interface Auction {
|
|
||||||
index: string;
|
|
||||||
name: string;
|
|
||||||
description: string;
|
|
||||||
bids: Bid[];
|
|
||||||
}
|
|
||||||
|
|
||||||
const baseAuction: object = { index: "", name: "", description: "" };
|
|
||||||
|
|
||||||
export const Auction = {
|
|
||||||
encode(message: Auction, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.index !== "") {
|
|
||||||
writer.uint32(10).string(message.index);
|
|
||||||
}
|
|
||||||
if (message.name !== "") {
|
|
||||||
writer.uint32(18).string(message.name);
|
|
||||||
}
|
|
||||||
if (message.description !== "") {
|
|
||||||
writer.uint32(26).string(message.description);
|
|
||||||
}
|
|
||||||
for (const v of message.bids) {
|
|
||||||
Bid.encode(v!, writer.uint32(34).fork()).ldelim();
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): Auction {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseAuction } as Auction;
|
|
||||||
message.bids = [];
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.index = reader.string();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.name = reader.string();
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
message.description = reader.string();
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
message.bids.push(Bid.decode(reader, reader.uint32()));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): Auction {
|
|
||||||
const message = { ...baseAuction } as Auction;
|
|
||||||
message.bids = [];
|
|
||||||
if (object.index !== undefined && object.index !== null) {
|
|
||||||
message.index = String(object.index);
|
|
||||||
} else {
|
|
||||||
message.index = "";
|
|
||||||
}
|
|
||||||
if (object.name !== undefined && object.name !== null) {
|
|
||||||
message.name = String(object.name);
|
|
||||||
} else {
|
|
||||||
message.name = "";
|
|
||||||
}
|
|
||||||
if (object.description !== undefined && object.description !== null) {
|
|
||||||
message.description = String(object.description);
|
|
||||||
} else {
|
|
||||||
message.description = "";
|
|
||||||
}
|
|
||||||
if (object.bids !== undefined && object.bids !== null) {
|
|
||||||
for (const e of object.bids) {
|
|
||||||
message.bids.push(Bid.fromJSON(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: Auction): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.index !== undefined && (obj.index = message.index);
|
|
||||||
message.name !== undefined && (obj.name = message.name);
|
|
||||||
message.description !== undefined &&
|
|
||||||
(obj.description = message.description);
|
|
||||||
if (message.bids) {
|
|
||||||
obj.bids = message.bids.map((e) => (e ? Bid.toJSON(e) : undefined));
|
|
||||||
} else {
|
|
||||||
obj.bids = [];
|
|
||||||
}
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<Auction>): Auction {
|
|
||||||
const message = { ...baseAuction } as Auction;
|
|
||||||
message.bids = [];
|
|
||||||
if (object.index !== undefined && object.index !== null) {
|
|
||||||
message.index = object.index;
|
|
||||||
} else {
|
|
||||||
message.index = "";
|
|
||||||
}
|
|
||||||
if (object.name !== undefined && object.name !== null) {
|
|
||||||
message.name = object.name;
|
|
||||||
} else {
|
|
||||||
message.name = "";
|
|
||||||
}
|
|
||||||
if (object.description !== undefined && object.description !== null) {
|
|
||||||
message.description = object.description;
|
|
||||||
} else {
|
|
||||||
message.description = "";
|
|
||||||
}
|
|
||||||
if (object.bids !== undefined && object.bids !== null) {
|
|
||||||
for (const e of object.bids) {
|
|
||||||
message.bids.push(Bid.fromPartial(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
||||||
export type DeepPartial<T> = T extends Builtin
|
|
||||||
? T
|
|
||||||
: T extends Array<infer U>
|
|
||||||
? Array<DeepPartial<U>>
|
|
||||||
: T extends ReadonlyArray<infer U>
|
|
||||||
? ReadonlyArray<DeepPartial<U>>
|
|
||||||
: T extends {}
|
|
||||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
||||||
: Partial<T>;
|
|
|
@ -1,92 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import { Writer, Reader } from "protobufjs/minimal";
|
|
||||||
|
|
||||||
export const protobufPackage = "cosmostest.cosmostest";
|
|
||||||
|
|
||||||
export interface Bid {
|
|
||||||
owner: string;
|
|
||||||
amount: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
const baseBid: object = { owner: "", amount: "" };
|
|
||||||
|
|
||||||
export const Bid = {
|
|
||||||
encode(message: Bid, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.owner !== "") {
|
|
||||||
writer.uint32(10).string(message.owner);
|
|
||||||
}
|
|
||||||
if (message.amount !== "") {
|
|
||||||
writer.uint32(18).string(message.amount);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): Bid {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseBid } as Bid;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.owner = reader.string();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.amount = reader.string();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): Bid {
|
|
||||||
const message = { ...baseBid } as Bid;
|
|
||||||
if (object.owner !== undefined && object.owner !== null) {
|
|
||||||
message.owner = String(object.owner);
|
|
||||||
} else {
|
|
||||||
message.owner = "";
|
|
||||||
}
|
|
||||||
if (object.amount !== undefined && object.amount !== null) {
|
|
||||||
message.amount = String(object.amount);
|
|
||||||
} else {
|
|
||||||
message.amount = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: Bid): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.owner !== undefined && (obj.owner = message.owner);
|
|
||||||
message.amount !== undefined && (obj.amount = message.amount);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<Bid>): Bid {
|
|
||||||
const message = { ...baseBid } as Bid;
|
|
||||||
if (object.owner !== undefined && object.owner !== null) {
|
|
||||||
message.owner = object.owner;
|
|
||||||
} else {
|
|
||||||
message.owner = "";
|
|
||||||
}
|
|
||||||
if (object.amount !== undefined && object.amount !== null) {
|
|
||||||
message.amount = object.amount;
|
|
||||||
} else {
|
|
||||||
message.amount = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
||||||
export type DeepPartial<T> = T extends Builtin
|
|
||||||
? T
|
|
||||||
: T extends Array<infer U>
|
|
||||||
? Array<DeepPartial<U>>
|
|
||||||
: T extends ReadonlyArray<infer U>
|
|
||||||
? ReadonlyArray<DeepPartial<U>>
|
|
||||||
: T extends {}
|
|
||||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
||||||
: Partial<T>;
|
|
|
@ -1,131 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import { Params } from "../cosmostest/params";
|
|
||||||
import { NextAuction } from "../cosmostest/next_auction";
|
|
||||||
import { Auction } from "../cosmostest/auction";
|
|
||||||
import { Writer, Reader } from "protobufjs/minimal";
|
|
||||||
|
|
||||||
export const protobufPackage = "cosmostest.cosmostest";
|
|
||||||
|
|
||||||
/** GenesisState defines the cosmostest module's genesis state. */
|
|
||||||
export interface GenesisState {
|
|
||||||
params: Params | undefined;
|
|
||||||
nextAuction: NextAuction | undefined;
|
|
||||||
/** this line is used by starport scaffolding # genesis/proto/state */
|
|
||||||
auctionList: Auction[];
|
|
||||||
}
|
|
||||||
|
|
||||||
const baseGenesisState: object = {};
|
|
||||||
|
|
||||||
export const GenesisState = {
|
|
||||||
encode(message: GenesisState, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.params !== undefined) {
|
|
||||||
Params.encode(message.params, writer.uint32(10).fork()).ldelim();
|
|
||||||
}
|
|
||||||
if (message.nextAuction !== undefined) {
|
|
||||||
NextAuction.encode(
|
|
||||||
message.nextAuction,
|
|
||||||
writer.uint32(18).fork()
|
|
||||||
).ldelim();
|
|
||||||
}
|
|
||||||
for (const v of message.auctionList) {
|
|
||||||
Auction.encode(v!, writer.uint32(26).fork()).ldelim();
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): GenesisState {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseGenesisState } as GenesisState;
|
|
||||||
message.auctionList = [];
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.params = Params.decode(reader, reader.uint32());
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.nextAuction = NextAuction.decode(reader, reader.uint32());
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
message.auctionList.push(Auction.decode(reader, reader.uint32()));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): GenesisState {
|
|
||||||
const message = { ...baseGenesisState } as GenesisState;
|
|
||||||
message.auctionList = [];
|
|
||||||
if (object.params !== undefined && object.params !== null) {
|
|
||||||
message.params = Params.fromJSON(object.params);
|
|
||||||
} else {
|
|
||||||
message.params = undefined;
|
|
||||||
}
|
|
||||||
if (object.nextAuction !== undefined && object.nextAuction !== null) {
|
|
||||||
message.nextAuction = NextAuction.fromJSON(object.nextAuction);
|
|
||||||
} else {
|
|
||||||
message.nextAuction = undefined;
|
|
||||||
}
|
|
||||||
if (object.auctionList !== undefined && object.auctionList !== null) {
|
|
||||||
for (const e of object.auctionList) {
|
|
||||||
message.auctionList.push(Auction.fromJSON(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: GenesisState): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.params !== undefined &&
|
|
||||||
(obj.params = message.params ? Params.toJSON(message.params) : undefined);
|
|
||||||
message.nextAuction !== undefined &&
|
|
||||||
(obj.nextAuction = message.nextAuction
|
|
||||||
? NextAuction.toJSON(message.nextAuction)
|
|
||||||
: undefined);
|
|
||||||
if (message.auctionList) {
|
|
||||||
obj.auctionList = message.auctionList.map((e) =>
|
|
||||||
e ? Auction.toJSON(e) : undefined
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
obj.auctionList = [];
|
|
||||||
}
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<GenesisState>): GenesisState {
|
|
||||||
const message = { ...baseGenesisState } as GenesisState;
|
|
||||||
message.auctionList = [];
|
|
||||||
if (object.params !== undefined && object.params !== null) {
|
|
||||||
message.params = Params.fromPartial(object.params);
|
|
||||||
} else {
|
|
||||||
message.params = undefined;
|
|
||||||
}
|
|
||||||
if (object.nextAuction !== undefined && object.nextAuction !== null) {
|
|
||||||
message.nextAuction = NextAuction.fromPartial(object.nextAuction);
|
|
||||||
} else {
|
|
||||||
message.nextAuction = undefined;
|
|
||||||
}
|
|
||||||
if (object.auctionList !== undefined && object.auctionList !== null) {
|
|
||||||
for (const e of object.auctionList) {
|
|
||||||
message.auctionList.push(Auction.fromPartial(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
||||||
export type DeepPartial<T> = T extends Builtin
|
|
||||||
? T
|
|
||||||
: T extends Array<infer U>
|
|
||||||
? Array<DeepPartial<U>>
|
|
||||||
: T extends ReadonlyArray<infer U>
|
|
||||||
? ReadonlyArray<DeepPartial<U>>
|
|
||||||
: T extends {}
|
|
||||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
||||||
: Partial<T>;
|
|
|
@ -1,97 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import * as Long from "long";
|
|
||||||
import { util, configure, Writer, Reader } from "protobufjs/minimal";
|
|
||||||
|
|
||||||
export const protobufPackage = "cosmostest.cosmostest";
|
|
||||||
|
|
||||||
export interface NextAuction {
|
|
||||||
auctionId: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
const baseNextAuction: object = { auctionId: 0 };
|
|
||||||
|
|
||||||
export const NextAuction = {
|
|
||||||
encode(message: NextAuction, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.auctionId !== 0) {
|
|
||||||
writer.uint32(8).uint64(message.auctionId);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): NextAuction {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseNextAuction } as NextAuction;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.auctionId = longToNumber(reader.uint64() as Long);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): NextAuction {
|
|
||||||
const message = { ...baseNextAuction } as NextAuction;
|
|
||||||
if (object.auctionId !== undefined && object.auctionId !== null) {
|
|
||||||
message.auctionId = Number(object.auctionId);
|
|
||||||
} else {
|
|
||||||
message.auctionId = 0;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: NextAuction): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.auctionId !== undefined && (obj.auctionId = message.auctionId);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<NextAuction>): NextAuction {
|
|
||||||
const message = { ...baseNextAuction } as NextAuction;
|
|
||||||
if (object.auctionId !== undefined && object.auctionId !== null) {
|
|
||||||
message.auctionId = object.auctionId;
|
|
||||||
} else {
|
|
||||||
message.auctionId = 0;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
declare var self: any | undefined;
|
|
||||||
declare var window: any | undefined;
|
|
||||||
var globalThis: any = (() => {
|
|
||||||
if (typeof globalThis !== "undefined") return globalThis;
|
|
||||||
if (typeof self !== "undefined") return self;
|
|
||||||
if (typeof window !== "undefined") return window;
|
|
||||||
if (typeof global !== "undefined") return global;
|
|
||||||
throw "Unable to locate global object";
|
|
||||||
})();
|
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
||||||
export type DeepPartial<T> = T extends Builtin
|
|
||||||
? T
|
|
||||||
: T extends Array<infer U>
|
|
||||||
? Array<DeepPartial<U>>
|
|
||||||
: T extends ReadonlyArray<infer U>
|
|
||||||
? ReadonlyArray<DeepPartial<U>>
|
|
||||||
: T extends {}
|
|
||||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
||||||
: Partial<T>;
|
|
||||||
|
|
||||||
function longToNumber(long: Long): number {
|
|
||||||
if (long.gt(Number.MAX_SAFE_INTEGER)) {
|
|
||||||
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
|
||||||
}
|
|
||||||
return long.toNumber();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (util.Long !== Long) {
|
|
||||||
util.Long = Long as any;
|
|
||||||
configure();
|
|
||||||
}
|
|
|
@ -1,56 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import { Writer, Reader } from "protobufjs/minimal";
|
|
||||||
|
|
||||||
export const protobufPackage = "cosmostest.cosmostest";
|
|
||||||
|
|
||||||
/** Params defines the parameters for the module. */
|
|
||||||
export interface Params {}
|
|
||||||
|
|
||||||
const baseParams: object = {};
|
|
||||||
|
|
||||||
export const Params = {
|
|
||||||
encode(_: Params, writer: Writer = Writer.create()): Writer {
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): Params {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseParams } as Params;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(_: any): Params {
|
|
||||||
const message = { ...baseParams } as Params;
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(_: Params): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(_: DeepPartial<Params>): Params {
|
|
||||||
const message = { ...baseParams } as Params;
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
||||||
export type DeepPartial<T> = T extends Builtin
|
|
||||||
? T
|
|
||||||
: T extends Array<infer U>
|
|
||||||
? Array<DeepPartial<U>>
|
|
||||||
: T extends ReadonlyArray<infer U>
|
|
||||||
? ReadonlyArray<DeepPartial<U>>
|
|
||||||
: T extends {}
|
|
||||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
||||||
: Partial<T>;
|
|
|
@ -1,646 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import { Reader, Writer } from "protobufjs/minimal";
|
|
||||||
import { Params } from "../cosmostest/params";
|
|
||||||
import { NextAuction } from "../cosmostest/next_auction";
|
|
||||||
import { Auction } from "../cosmostest/auction";
|
|
||||||
import {
|
|
||||||
PageRequest,
|
|
||||||
PageResponse,
|
|
||||||
} from "../cosmos/base/query/v1beta1/pagination";
|
|
||||||
|
|
||||||
export const protobufPackage = "cosmostest.cosmostest";
|
|
||||||
|
|
||||||
/** QueryParamsRequest is request type for the Query/Params RPC method. */
|
|
||||||
export interface QueryParamsRequest {}
|
|
||||||
|
|
||||||
/** QueryParamsResponse is response type for the Query/Params RPC method. */
|
|
||||||
export interface QueryParamsResponse {
|
|
||||||
/** params holds all the parameters of this module. */
|
|
||||||
params: Params | undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface QueryGetNextAuctionRequest {}
|
|
||||||
|
|
||||||
export interface QueryGetNextAuctionResponse {
|
|
||||||
NextAuction: NextAuction | undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface QueryGetAuctionRequest {
|
|
||||||
index: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface QueryGetAuctionResponse {
|
|
||||||
auction: Auction | undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface QueryAllAuctionRequest {
|
|
||||||
pagination: PageRequest | undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface QueryAllAuctionResponse {
|
|
||||||
auction: Auction[];
|
|
||||||
pagination: PageResponse | undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
const baseQueryParamsRequest: object = {};
|
|
||||||
|
|
||||||
export const QueryParamsRequest = {
|
|
||||||
encode(_: QueryParamsRequest, writer: Writer = Writer.create()): Writer {
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): QueryParamsRequest {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseQueryParamsRequest } as QueryParamsRequest;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(_: any): QueryParamsRequest {
|
|
||||||
const message = { ...baseQueryParamsRequest } as QueryParamsRequest;
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(_: QueryParamsRequest): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(_: DeepPartial<QueryParamsRequest>): QueryParamsRequest {
|
|
||||||
const message = { ...baseQueryParamsRequest } as QueryParamsRequest;
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseQueryParamsResponse: object = {};
|
|
||||||
|
|
||||||
export const QueryParamsResponse = {
|
|
||||||
encode(
|
|
||||||
message: QueryParamsResponse,
|
|
||||||
writer: Writer = Writer.create()
|
|
||||||
): Writer {
|
|
||||||
if (message.params !== undefined) {
|
|
||||||
Params.encode(message.params, writer.uint32(10).fork()).ldelim();
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): QueryParamsResponse {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseQueryParamsResponse } as QueryParamsResponse;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.params = Params.decode(reader, reader.uint32());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): QueryParamsResponse {
|
|
||||||
const message = { ...baseQueryParamsResponse } as QueryParamsResponse;
|
|
||||||
if (object.params !== undefined && object.params !== null) {
|
|
||||||
message.params = Params.fromJSON(object.params);
|
|
||||||
} else {
|
|
||||||
message.params = undefined;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: QueryParamsResponse): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.params !== undefined &&
|
|
||||||
(obj.params = message.params ? Params.toJSON(message.params) : undefined);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<QueryParamsResponse>): QueryParamsResponse {
|
|
||||||
const message = { ...baseQueryParamsResponse } as QueryParamsResponse;
|
|
||||||
if (object.params !== undefined && object.params !== null) {
|
|
||||||
message.params = Params.fromPartial(object.params);
|
|
||||||
} else {
|
|
||||||
message.params = undefined;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseQueryGetNextAuctionRequest: object = {};
|
|
||||||
|
|
||||||
export const QueryGetNextAuctionRequest = {
|
|
||||||
encode(
|
|
||||||
_: QueryGetNextAuctionRequest,
|
|
||||||
writer: Writer = Writer.create()
|
|
||||||
): Writer {
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(
|
|
||||||
input: Reader | Uint8Array,
|
|
||||||
length?: number
|
|
||||||
): QueryGetNextAuctionRequest {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = {
|
|
||||||
...baseQueryGetNextAuctionRequest,
|
|
||||||
} as QueryGetNextAuctionRequest;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(_: any): QueryGetNextAuctionRequest {
|
|
||||||
const message = {
|
|
||||||
...baseQueryGetNextAuctionRequest,
|
|
||||||
} as QueryGetNextAuctionRequest;
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(_: QueryGetNextAuctionRequest): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(
|
|
||||||
_: DeepPartial<QueryGetNextAuctionRequest>
|
|
||||||
): QueryGetNextAuctionRequest {
|
|
||||||
const message = {
|
|
||||||
...baseQueryGetNextAuctionRequest,
|
|
||||||
} as QueryGetNextAuctionRequest;
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseQueryGetNextAuctionResponse: object = {};
|
|
||||||
|
|
||||||
export const QueryGetNextAuctionResponse = {
|
|
||||||
encode(
|
|
||||||
message: QueryGetNextAuctionResponse,
|
|
||||||
writer: Writer = Writer.create()
|
|
||||||
): Writer {
|
|
||||||
if (message.NextAuction !== undefined) {
|
|
||||||
NextAuction.encode(
|
|
||||||
message.NextAuction,
|
|
||||||
writer.uint32(10).fork()
|
|
||||||
).ldelim();
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(
|
|
||||||
input: Reader | Uint8Array,
|
|
||||||
length?: number
|
|
||||||
): QueryGetNextAuctionResponse {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = {
|
|
||||||
...baseQueryGetNextAuctionResponse,
|
|
||||||
} as QueryGetNextAuctionResponse;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.NextAuction = NextAuction.decode(reader, reader.uint32());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): QueryGetNextAuctionResponse {
|
|
||||||
const message = {
|
|
||||||
...baseQueryGetNextAuctionResponse,
|
|
||||||
} as QueryGetNextAuctionResponse;
|
|
||||||
if (object.NextAuction !== undefined && object.NextAuction !== null) {
|
|
||||||
message.NextAuction = NextAuction.fromJSON(object.NextAuction);
|
|
||||||
} else {
|
|
||||||
message.NextAuction = undefined;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: QueryGetNextAuctionResponse): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.NextAuction !== undefined &&
|
|
||||||
(obj.NextAuction = message.NextAuction
|
|
||||||
? NextAuction.toJSON(message.NextAuction)
|
|
||||||
: undefined);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(
|
|
||||||
object: DeepPartial<QueryGetNextAuctionResponse>
|
|
||||||
): QueryGetNextAuctionResponse {
|
|
||||||
const message = {
|
|
||||||
...baseQueryGetNextAuctionResponse,
|
|
||||||
} as QueryGetNextAuctionResponse;
|
|
||||||
if (object.NextAuction !== undefined && object.NextAuction !== null) {
|
|
||||||
message.NextAuction = NextAuction.fromPartial(object.NextAuction);
|
|
||||||
} else {
|
|
||||||
message.NextAuction = undefined;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseQueryGetAuctionRequest: object = { index: "" };
|
|
||||||
|
|
||||||
export const QueryGetAuctionRequest = {
|
|
||||||
encode(
|
|
||||||
message: QueryGetAuctionRequest,
|
|
||||||
writer: Writer = Writer.create()
|
|
||||||
): Writer {
|
|
||||||
if (message.index !== "") {
|
|
||||||
writer.uint32(10).string(message.index);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): QueryGetAuctionRequest {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseQueryGetAuctionRequest } as QueryGetAuctionRequest;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.index = reader.string();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): QueryGetAuctionRequest {
|
|
||||||
const message = { ...baseQueryGetAuctionRequest } as QueryGetAuctionRequest;
|
|
||||||
if (object.index !== undefined && object.index !== null) {
|
|
||||||
message.index = String(object.index);
|
|
||||||
} else {
|
|
||||||
message.index = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: QueryGetAuctionRequest): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.index !== undefined && (obj.index = message.index);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(
|
|
||||||
object: DeepPartial<QueryGetAuctionRequest>
|
|
||||||
): QueryGetAuctionRequest {
|
|
||||||
const message = { ...baseQueryGetAuctionRequest } as QueryGetAuctionRequest;
|
|
||||||
if (object.index !== undefined && object.index !== null) {
|
|
||||||
message.index = object.index;
|
|
||||||
} else {
|
|
||||||
message.index = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseQueryGetAuctionResponse: object = {};
|
|
||||||
|
|
||||||
export const QueryGetAuctionResponse = {
|
|
||||||
encode(
|
|
||||||
message: QueryGetAuctionResponse,
|
|
||||||
writer: Writer = Writer.create()
|
|
||||||
): Writer {
|
|
||||||
if (message.auction !== undefined) {
|
|
||||||
Auction.encode(message.auction, writer.uint32(10).fork()).ldelim();
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): QueryGetAuctionResponse {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = {
|
|
||||||
...baseQueryGetAuctionResponse,
|
|
||||||
} as QueryGetAuctionResponse;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.auction = Auction.decode(reader, reader.uint32());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): QueryGetAuctionResponse {
|
|
||||||
const message = {
|
|
||||||
...baseQueryGetAuctionResponse,
|
|
||||||
} as QueryGetAuctionResponse;
|
|
||||||
if (object.auction !== undefined && object.auction !== null) {
|
|
||||||
message.auction = Auction.fromJSON(object.auction);
|
|
||||||
} else {
|
|
||||||
message.auction = undefined;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: QueryGetAuctionResponse): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.auction !== undefined &&
|
|
||||||
(obj.auction = message.auction
|
|
||||||
? Auction.toJSON(message.auction)
|
|
||||||
: undefined);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(
|
|
||||||
object: DeepPartial<QueryGetAuctionResponse>
|
|
||||||
): QueryGetAuctionResponse {
|
|
||||||
const message = {
|
|
||||||
...baseQueryGetAuctionResponse,
|
|
||||||
} as QueryGetAuctionResponse;
|
|
||||||
if (object.auction !== undefined && object.auction !== null) {
|
|
||||||
message.auction = Auction.fromPartial(object.auction);
|
|
||||||
} else {
|
|
||||||
message.auction = undefined;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseQueryAllAuctionRequest: object = {};
|
|
||||||
|
|
||||||
export const QueryAllAuctionRequest = {
|
|
||||||
encode(
|
|
||||||
message: QueryAllAuctionRequest,
|
|
||||||
writer: Writer = Writer.create()
|
|
||||||
): Writer {
|
|
||||||
if (message.pagination !== undefined) {
|
|
||||||
PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim();
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): QueryAllAuctionRequest {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseQueryAllAuctionRequest } as QueryAllAuctionRequest;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.pagination = PageRequest.decode(reader, reader.uint32());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): QueryAllAuctionRequest {
|
|
||||||
const message = { ...baseQueryAllAuctionRequest } as QueryAllAuctionRequest;
|
|
||||||
if (object.pagination !== undefined && object.pagination !== null) {
|
|
||||||
message.pagination = PageRequest.fromJSON(object.pagination);
|
|
||||||
} else {
|
|
||||||
message.pagination = undefined;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: QueryAllAuctionRequest): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.pagination !== undefined &&
|
|
||||||
(obj.pagination = message.pagination
|
|
||||||
? PageRequest.toJSON(message.pagination)
|
|
||||||
: undefined);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(
|
|
||||||
object: DeepPartial<QueryAllAuctionRequest>
|
|
||||||
): QueryAllAuctionRequest {
|
|
||||||
const message = { ...baseQueryAllAuctionRequest } as QueryAllAuctionRequest;
|
|
||||||
if (object.pagination !== undefined && object.pagination !== null) {
|
|
||||||
message.pagination = PageRequest.fromPartial(object.pagination);
|
|
||||||
} else {
|
|
||||||
message.pagination = undefined;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseQueryAllAuctionResponse: object = {};
|
|
||||||
|
|
||||||
export const QueryAllAuctionResponse = {
|
|
||||||
encode(
|
|
||||||
message: QueryAllAuctionResponse,
|
|
||||||
writer: Writer = Writer.create()
|
|
||||||
): Writer {
|
|
||||||
for (const v of message.auction) {
|
|
||||||
Auction.encode(v!, writer.uint32(10).fork()).ldelim();
|
|
||||||
}
|
|
||||||
if (message.pagination !== undefined) {
|
|
||||||
PageResponse.encode(
|
|
||||||
message.pagination,
|
|
||||||
writer.uint32(18).fork()
|
|
||||||
).ldelim();
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): QueryAllAuctionResponse {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = {
|
|
||||||
...baseQueryAllAuctionResponse,
|
|
||||||
} as QueryAllAuctionResponse;
|
|
||||||
message.auction = [];
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.auction.push(Auction.decode(reader, reader.uint32()));
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.pagination = PageResponse.decode(reader, reader.uint32());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): QueryAllAuctionResponse {
|
|
||||||
const message = {
|
|
||||||
...baseQueryAllAuctionResponse,
|
|
||||||
} as QueryAllAuctionResponse;
|
|
||||||
message.auction = [];
|
|
||||||
if (object.auction !== undefined && object.auction !== null) {
|
|
||||||
for (const e of object.auction) {
|
|
||||||
message.auction.push(Auction.fromJSON(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (object.pagination !== undefined && object.pagination !== null) {
|
|
||||||
message.pagination = PageResponse.fromJSON(object.pagination);
|
|
||||||
} else {
|
|
||||||
message.pagination = undefined;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: QueryAllAuctionResponse): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
if (message.auction) {
|
|
||||||
obj.auction = message.auction.map((e) =>
|
|
||||||
e ? Auction.toJSON(e) : undefined
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
obj.auction = [];
|
|
||||||
}
|
|
||||||
message.pagination !== undefined &&
|
|
||||||
(obj.pagination = message.pagination
|
|
||||||
? PageResponse.toJSON(message.pagination)
|
|
||||||
: undefined);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(
|
|
||||||
object: DeepPartial<QueryAllAuctionResponse>
|
|
||||||
): QueryAllAuctionResponse {
|
|
||||||
const message = {
|
|
||||||
...baseQueryAllAuctionResponse,
|
|
||||||
} as QueryAllAuctionResponse;
|
|
||||||
message.auction = [];
|
|
||||||
if (object.auction !== undefined && object.auction !== null) {
|
|
||||||
for (const e of object.auction) {
|
|
||||||
message.auction.push(Auction.fromPartial(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (object.pagination !== undefined && object.pagination !== null) {
|
|
||||||
message.pagination = PageResponse.fromPartial(object.pagination);
|
|
||||||
} else {
|
|
||||||
message.pagination = undefined;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
/** Query defines the gRPC querier service. */
|
|
||||||
export interface Query {
|
|
||||||
/** Parameters queries the parameters of the module. */
|
|
||||||
Params(request: QueryParamsRequest): Promise<QueryParamsResponse>;
|
|
||||||
/** Queries a NextAuction by index. */
|
|
||||||
NextAuction(
|
|
||||||
request: QueryGetNextAuctionRequest
|
|
||||||
): Promise<QueryGetNextAuctionResponse>;
|
|
||||||
/** Queries a Auction by index. */
|
|
||||||
Auction(request: QueryGetAuctionRequest): Promise<QueryGetAuctionResponse>;
|
|
||||||
/** Queries a list of Auction items. */
|
|
||||||
AuctionAll(request: QueryAllAuctionRequest): Promise<QueryAllAuctionResponse>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class QueryClientImpl implements Query {
|
|
||||||
private readonly rpc: Rpc;
|
|
||||||
constructor(rpc: Rpc) {
|
|
||||||
this.rpc = rpc;
|
|
||||||
}
|
|
||||||
Params(request: QueryParamsRequest): Promise<QueryParamsResponse> {
|
|
||||||
const data = QueryParamsRequest.encode(request).finish();
|
|
||||||
const promise = this.rpc.request(
|
|
||||||
"cosmostest.cosmostest.Query",
|
|
||||||
"Params",
|
|
||||||
data
|
|
||||||
);
|
|
||||||
return promise.then((data) => QueryParamsResponse.decode(new Reader(data)));
|
|
||||||
}
|
|
||||||
|
|
||||||
NextAuction(
|
|
||||||
request: QueryGetNextAuctionRequest
|
|
||||||
): Promise<QueryGetNextAuctionResponse> {
|
|
||||||
const data = QueryGetNextAuctionRequest.encode(request).finish();
|
|
||||||
const promise = this.rpc.request(
|
|
||||||
"cosmostest.cosmostest.Query",
|
|
||||||
"NextAuction",
|
|
||||||
data
|
|
||||||
);
|
|
||||||
return promise.then((data) =>
|
|
||||||
QueryGetNextAuctionResponse.decode(new Reader(data))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Auction(request: QueryGetAuctionRequest): Promise<QueryGetAuctionResponse> {
|
|
||||||
const data = QueryGetAuctionRequest.encode(request).finish();
|
|
||||||
const promise = this.rpc.request(
|
|
||||||
"cosmostest.cosmostest.Query",
|
|
||||||
"Auction",
|
|
||||||
data
|
|
||||||
);
|
|
||||||
return promise.then((data) =>
|
|
||||||
QueryGetAuctionResponse.decode(new Reader(data))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
AuctionAll(
|
|
||||||
request: QueryAllAuctionRequest
|
|
||||||
): Promise<QueryAllAuctionResponse> {
|
|
||||||
const data = QueryAllAuctionRequest.encode(request).finish();
|
|
||||||
const promise = this.rpc.request(
|
|
||||||
"cosmostest.cosmostest.Query",
|
|
||||||
"AuctionAll",
|
|
||||||
data
|
|
||||||
);
|
|
||||||
return promise.then((data) =>
|
|
||||||
QueryAllAuctionResponse.decode(new Reader(data))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Rpc {
|
|
||||||
request(
|
|
||||||
service: string,
|
|
||||||
method: string,
|
|
||||||
data: Uint8Array
|
|
||||||
): Promise<Uint8Array>;
|
|
||||||
}
|
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
||||||
export type DeepPartial<T> = T extends Builtin
|
|
||||||
? T
|
|
||||||
: T extends Array<infer U>
|
|
||||||
? Array<DeepPartial<U>>
|
|
||||||
: T extends ReadonlyArray<infer U>
|
|
||||||
? ReadonlyArray<DeepPartial<U>>
|
|
||||||
: T extends {}
|
|
||||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
||||||
: Partial<T>;
|
|
|
@ -1,377 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import { Reader, Writer } from "protobufjs/minimal";
|
|
||||||
|
|
||||||
export const protobufPackage = "cosmostest.cosmostest";
|
|
||||||
|
|
||||||
export interface MsgNewAuction {
|
|
||||||
creator: string;
|
|
||||||
owner: string;
|
|
||||||
name: string;
|
|
||||||
description: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface MsgNewAuctionResponse {
|
|
||||||
auctionId: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface MsgNewBid {
|
|
||||||
creator: string;
|
|
||||||
auctionIndex: string;
|
|
||||||
amount: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface MsgNewBidResponse {}
|
|
||||||
|
|
||||||
const baseMsgNewAuction: object = {
|
|
||||||
creator: "",
|
|
||||||
owner: "",
|
|
||||||
name: "",
|
|
||||||
description: "",
|
|
||||||
};
|
|
||||||
|
|
||||||
export const MsgNewAuction = {
|
|
||||||
encode(message: MsgNewAuction, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.creator !== "") {
|
|
||||||
writer.uint32(10).string(message.creator);
|
|
||||||
}
|
|
||||||
if (message.owner !== "") {
|
|
||||||
writer.uint32(18).string(message.owner);
|
|
||||||
}
|
|
||||||
if (message.name !== "") {
|
|
||||||
writer.uint32(26).string(message.name);
|
|
||||||
}
|
|
||||||
if (message.description !== "") {
|
|
||||||
writer.uint32(34).string(message.description);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): MsgNewAuction {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseMsgNewAuction } as MsgNewAuction;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.creator = reader.string();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.owner = reader.string();
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
message.name = reader.string();
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
message.description = reader.string();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): MsgNewAuction {
|
|
||||||
const message = { ...baseMsgNewAuction } as MsgNewAuction;
|
|
||||||
if (object.creator !== undefined && object.creator !== null) {
|
|
||||||
message.creator = String(object.creator);
|
|
||||||
} else {
|
|
||||||
message.creator = "";
|
|
||||||
}
|
|
||||||
if (object.owner !== undefined && object.owner !== null) {
|
|
||||||
message.owner = String(object.owner);
|
|
||||||
} else {
|
|
||||||
message.owner = "";
|
|
||||||
}
|
|
||||||
if (object.name !== undefined && object.name !== null) {
|
|
||||||
message.name = String(object.name);
|
|
||||||
} else {
|
|
||||||
message.name = "";
|
|
||||||
}
|
|
||||||
if (object.description !== undefined && object.description !== null) {
|
|
||||||
message.description = String(object.description);
|
|
||||||
} else {
|
|
||||||
message.description = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: MsgNewAuction): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.creator !== undefined && (obj.creator = message.creator);
|
|
||||||
message.owner !== undefined && (obj.owner = message.owner);
|
|
||||||
message.name !== undefined && (obj.name = message.name);
|
|
||||||
message.description !== undefined &&
|
|
||||||
(obj.description = message.description);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<MsgNewAuction>): MsgNewAuction {
|
|
||||||
const message = { ...baseMsgNewAuction } as MsgNewAuction;
|
|
||||||
if (object.creator !== undefined && object.creator !== null) {
|
|
||||||
message.creator = object.creator;
|
|
||||||
} else {
|
|
||||||
message.creator = "";
|
|
||||||
}
|
|
||||||
if (object.owner !== undefined && object.owner !== null) {
|
|
||||||
message.owner = object.owner;
|
|
||||||
} else {
|
|
||||||
message.owner = "";
|
|
||||||
}
|
|
||||||
if (object.name !== undefined && object.name !== null) {
|
|
||||||
message.name = object.name;
|
|
||||||
} else {
|
|
||||||
message.name = "";
|
|
||||||
}
|
|
||||||
if (object.description !== undefined && object.description !== null) {
|
|
||||||
message.description = object.description;
|
|
||||||
} else {
|
|
||||||
message.description = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseMsgNewAuctionResponse: object = { auctionId: "" };
|
|
||||||
|
|
||||||
export const MsgNewAuctionResponse = {
|
|
||||||
encode(
|
|
||||||
message: MsgNewAuctionResponse,
|
|
||||||
writer: Writer = Writer.create()
|
|
||||||
): Writer {
|
|
||||||
if (message.auctionId !== "") {
|
|
||||||
writer.uint32(10).string(message.auctionId);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): MsgNewAuctionResponse {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseMsgNewAuctionResponse } as MsgNewAuctionResponse;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.auctionId = reader.string();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): MsgNewAuctionResponse {
|
|
||||||
const message = { ...baseMsgNewAuctionResponse } as MsgNewAuctionResponse;
|
|
||||||
if (object.auctionId !== undefined && object.auctionId !== null) {
|
|
||||||
message.auctionId = String(object.auctionId);
|
|
||||||
} else {
|
|
||||||
message.auctionId = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: MsgNewAuctionResponse): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.auctionId !== undefined && (obj.auctionId = message.auctionId);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(
|
|
||||||
object: DeepPartial<MsgNewAuctionResponse>
|
|
||||||
): MsgNewAuctionResponse {
|
|
||||||
const message = { ...baseMsgNewAuctionResponse } as MsgNewAuctionResponse;
|
|
||||||
if (object.auctionId !== undefined && object.auctionId !== null) {
|
|
||||||
message.auctionId = object.auctionId;
|
|
||||||
} else {
|
|
||||||
message.auctionId = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseMsgNewBid: object = { creator: "", auctionIndex: "", amount: "" };
|
|
||||||
|
|
||||||
export const MsgNewBid = {
|
|
||||||
encode(message: MsgNewBid, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.creator !== "") {
|
|
||||||
writer.uint32(10).string(message.creator);
|
|
||||||
}
|
|
||||||
if (message.auctionIndex !== "") {
|
|
||||||
writer.uint32(18).string(message.auctionIndex);
|
|
||||||
}
|
|
||||||
if (message.amount !== "") {
|
|
||||||
writer.uint32(26).string(message.amount);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): MsgNewBid {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseMsgNewBid } as MsgNewBid;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.creator = reader.string();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.auctionIndex = reader.string();
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
message.amount = reader.string();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): MsgNewBid {
|
|
||||||
const message = { ...baseMsgNewBid } as MsgNewBid;
|
|
||||||
if (object.creator !== undefined && object.creator !== null) {
|
|
||||||
message.creator = String(object.creator);
|
|
||||||
} else {
|
|
||||||
message.creator = "";
|
|
||||||
}
|
|
||||||
if (object.auctionIndex !== undefined && object.auctionIndex !== null) {
|
|
||||||
message.auctionIndex = String(object.auctionIndex);
|
|
||||||
} else {
|
|
||||||
message.auctionIndex = "";
|
|
||||||
}
|
|
||||||
if (object.amount !== undefined && object.amount !== null) {
|
|
||||||
message.amount = String(object.amount);
|
|
||||||
} else {
|
|
||||||
message.amount = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: MsgNewBid): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.creator !== undefined && (obj.creator = message.creator);
|
|
||||||
message.auctionIndex !== undefined &&
|
|
||||||
(obj.auctionIndex = message.auctionIndex);
|
|
||||||
message.amount !== undefined && (obj.amount = message.amount);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<MsgNewBid>): MsgNewBid {
|
|
||||||
const message = { ...baseMsgNewBid } as MsgNewBid;
|
|
||||||
if (object.creator !== undefined && object.creator !== null) {
|
|
||||||
message.creator = object.creator;
|
|
||||||
} else {
|
|
||||||
message.creator = "";
|
|
||||||
}
|
|
||||||
if (object.auctionIndex !== undefined && object.auctionIndex !== null) {
|
|
||||||
message.auctionIndex = object.auctionIndex;
|
|
||||||
} else {
|
|
||||||
message.auctionIndex = "";
|
|
||||||
}
|
|
||||||
if (object.amount !== undefined && object.amount !== null) {
|
|
||||||
message.amount = object.amount;
|
|
||||||
} else {
|
|
||||||
message.amount = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseMsgNewBidResponse: object = {};
|
|
||||||
|
|
||||||
export const MsgNewBidResponse = {
|
|
||||||
encode(_: MsgNewBidResponse, writer: Writer = Writer.create()): Writer {
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): MsgNewBidResponse {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseMsgNewBidResponse } as MsgNewBidResponse;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(_: any): MsgNewBidResponse {
|
|
||||||
const message = { ...baseMsgNewBidResponse } as MsgNewBidResponse;
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(_: MsgNewBidResponse): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(_: DeepPartial<MsgNewBidResponse>): MsgNewBidResponse {
|
|
||||||
const message = { ...baseMsgNewBidResponse } as MsgNewBidResponse;
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
/** Msg defines the Msg service. */
|
|
||||||
export interface Msg {
|
|
||||||
NewAuction(request: MsgNewAuction): Promise<MsgNewAuctionResponse>;
|
|
||||||
/** this line is used by starport scaffolding # proto/tx/rpc */
|
|
||||||
NewBid(request: MsgNewBid): Promise<MsgNewBidResponse>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class MsgClientImpl implements Msg {
|
|
||||||
private readonly rpc: Rpc;
|
|
||||||
constructor(rpc: Rpc) {
|
|
||||||
this.rpc = rpc;
|
|
||||||
}
|
|
||||||
NewAuction(request: MsgNewAuction): Promise<MsgNewAuctionResponse> {
|
|
||||||
const data = MsgNewAuction.encode(request).finish();
|
|
||||||
const promise = this.rpc.request(
|
|
||||||
"cosmostest.cosmostest.Msg",
|
|
||||||
"NewAuction",
|
|
||||||
data
|
|
||||||
);
|
|
||||||
return promise.then((data) =>
|
|
||||||
MsgNewAuctionResponse.decode(new Reader(data))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
NewBid(request: MsgNewBid): Promise<MsgNewBidResponse> {
|
|
||||||
const data = MsgNewBid.encode(request).finish();
|
|
||||||
const promise = this.rpc.request(
|
|
||||||
"cosmostest.cosmostest.Msg",
|
|
||||||
"NewBid",
|
|
||||||
data
|
|
||||||
);
|
|
||||||
return promise.then((data) => MsgNewBidResponse.decode(new Reader(data)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Rpc {
|
|
||||||
request(
|
|
||||||
service: string,
|
|
||||||
method: string,
|
|
||||||
data: Uint8Array
|
|
||||||
): Promise<Uint8Array>;
|
|
||||||
}
|
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
||||||
export type DeepPartial<T> = T extends Builtin
|
|
||||||
? T
|
|
||||||
: T extends Array<infer U>
|
|
||||||
? Array<DeepPartial<U>>
|
|
||||||
: T extends ReadonlyArray<infer U>
|
|
||||||
? ReadonlyArray<DeepPartial<U>>
|
|
||||||
: T extends {}
|
|
||||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
||||||
: Partial<T>;
|
|
|
@ -1,2 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
export const protobufPackage = "gogoproto";
|
|
|
@ -1,2 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
export const protobufPackage = "google.api";
|
|
|
@ -1,706 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import { Writer, Reader } from "protobufjs/minimal";
|
|
||||||
|
|
||||||
export const protobufPackage = "google.api";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Defines the HTTP configuration for an API service. It contains a list of
|
|
||||||
* [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method
|
|
||||||
* to one or more HTTP REST API methods.
|
|
||||||
*/
|
|
||||||
export interface Http {
|
|
||||||
/**
|
|
||||||
* A list of HTTP configuration rules that apply to individual API methods.
|
|
||||||
*
|
|
||||||
* **NOTE:** All service configuration rules follow "last one wins" order.
|
|
||||||
*/
|
|
||||||
rules: HttpRule[];
|
|
||||||
/**
|
|
||||||
* When set to true, URL path parmeters will be fully URI-decoded except in
|
|
||||||
* cases of single segment matches in reserved expansion, where "%2F" will be
|
|
||||||
* left encoded.
|
|
||||||
*
|
|
||||||
* The default behavior is to not decode RFC 6570 reserved characters in multi
|
|
||||||
* segment matches.
|
|
||||||
*/
|
|
||||||
fully_decode_reserved_expansion: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* `HttpRule` defines the mapping of an RPC method to one or more HTTP
|
|
||||||
* REST API methods. The mapping specifies how different portions of the RPC
|
|
||||||
* request message are mapped to URL path, URL query parameters, and
|
|
||||||
* HTTP request body. The mapping is typically specified as an
|
|
||||||
* `google.api.http` annotation on the RPC method,
|
|
||||||
* see "google/api/annotations.proto" for details.
|
|
||||||
*
|
|
||||||
* The mapping consists of a field specifying the path template and
|
|
||||||
* method kind. The path template can refer to fields in the request
|
|
||||||
* message, as in the example below which describes a REST GET
|
|
||||||
* operation on a resource collection of messages:
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* service Messaging {
|
|
||||||
* rpc GetMessage(GetMessageRequest) returns (Message) {
|
|
||||||
* option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}";
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* message GetMessageRequest {
|
|
||||||
* message SubMessage {
|
|
||||||
* string subfield = 1;
|
|
||||||
* }
|
|
||||||
* string message_id = 1; // mapped to the URL
|
|
||||||
* SubMessage sub = 2; // `sub.subfield` is url-mapped
|
|
||||||
* }
|
|
||||||
* message Message {
|
|
||||||
* string text = 1; // content of the resource
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* The same http annotation can alternatively be expressed inside the
|
|
||||||
* `GRPC API Configuration` YAML file.
|
|
||||||
*
|
|
||||||
* http:
|
|
||||||
* rules:
|
|
||||||
* - selector: <proto_package_name>.Messaging.GetMessage
|
|
||||||
* get: /v1/messages/{message_id}/{sub.subfield}
|
|
||||||
*
|
|
||||||
* This definition enables an automatic, bidrectional mapping of HTTP
|
|
||||||
* JSON to RPC. Example:
|
|
||||||
*
|
|
||||||
* HTTP | RPC
|
|
||||||
* -----|-----
|
|
||||||
* `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))`
|
|
||||||
*
|
|
||||||
* In general, not only fields but also field paths can be referenced
|
|
||||||
* from a path pattern. Fields mapped to the path pattern cannot be
|
|
||||||
* repeated and must have a primitive (non-message) type.
|
|
||||||
*
|
|
||||||
* Any fields in the request message which are not bound by the path
|
|
||||||
* pattern automatically become (optional) HTTP query
|
|
||||||
* parameters. Assume the following definition of the request message:
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* service Messaging {
|
|
||||||
* rpc GetMessage(GetMessageRequest) returns (Message) {
|
|
||||||
* option (google.api.http).get = "/v1/messages/{message_id}";
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* message GetMessageRequest {
|
|
||||||
* message SubMessage {
|
|
||||||
* string subfield = 1;
|
|
||||||
* }
|
|
||||||
* string message_id = 1; // mapped to the URL
|
|
||||||
* int64 revision = 2; // becomes a parameter
|
|
||||||
* SubMessage sub = 3; // `sub.subfield` becomes a parameter
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* This enables a HTTP JSON to RPC mapping as below:
|
|
||||||
*
|
|
||||||
* HTTP | RPC
|
|
||||||
* -----|-----
|
|
||||||
* `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))`
|
|
||||||
*
|
|
||||||
* Note that fields which are mapped to HTTP parameters must have a
|
|
||||||
* primitive type or a repeated primitive type. Message types are not
|
|
||||||
* allowed. In the case of a repeated type, the parameter can be
|
|
||||||
* repeated in the URL, as in `...?param=A¶m=B`.
|
|
||||||
*
|
|
||||||
* For HTTP method kinds which allow a request body, the `body` field
|
|
||||||
* specifies the mapping. Consider a REST update method on the
|
|
||||||
* message resource collection:
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* service Messaging {
|
|
||||||
* rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
|
|
||||||
* option (google.api.http) = {
|
|
||||||
* put: "/v1/messages/{message_id}"
|
|
||||||
* body: "message"
|
|
||||||
* };
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* message UpdateMessageRequest {
|
|
||||||
* string message_id = 1; // mapped to the URL
|
|
||||||
* Message message = 2; // mapped to the body
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* The following HTTP JSON to RPC mapping is enabled, where the
|
|
||||||
* representation of the JSON in the request body is determined by
|
|
||||||
* protos JSON encoding:
|
|
||||||
*
|
|
||||||
* HTTP | RPC
|
|
||||||
* -----|-----
|
|
||||||
* `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })`
|
|
||||||
*
|
|
||||||
* The special name `*` can be used in the body mapping to define that
|
|
||||||
* every field not bound by the path template should be mapped to the
|
|
||||||
* request body. This enables the following alternative definition of
|
|
||||||
* the update method:
|
|
||||||
*
|
|
||||||
* service Messaging {
|
|
||||||
* rpc UpdateMessage(Message) returns (Message) {
|
|
||||||
* option (google.api.http) = {
|
|
||||||
* put: "/v1/messages/{message_id}"
|
|
||||||
* body: "*"
|
|
||||||
* };
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* message Message {
|
|
||||||
* string message_id = 1;
|
|
||||||
* string text = 2;
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* The following HTTP JSON to RPC mapping is enabled:
|
|
||||||
*
|
|
||||||
* HTTP | RPC
|
|
||||||
* -----|-----
|
|
||||||
* `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")`
|
|
||||||
*
|
|
||||||
* Note that when using `*` in the body mapping, it is not possible to
|
|
||||||
* have HTTP parameters, as all fields not bound by the path end in
|
|
||||||
* the body. This makes this option more rarely used in practice of
|
|
||||||
* defining REST APIs. The common usage of `*` is in custom methods
|
|
||||||
* which don't use the URL at all for transferring data.
|
|
||||||
*
|
|
||||||
* It is possible to define multiple HTTP methods for one RPC by using
|
|
||||||
* the `additional_bindings` option. Example:
|
|
||||||
*
|
|
||||||
* service Messaging {
|
|
||||||
* rpc GetMessage(GetMessageRequest) returns (Message) {
|
|
||||||
* option (google.api.http) = {
|
|
||||||
* get: "/v1/messages/{message_id}"
|
|
||||||
* additional_bindings {
|
|
||||||
* get: "/v1/users/{user_id}/messages/{message_id}"
|
|
||||||
* }
|
|
||||||
* };
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* message GetMessageRequest {
|
|
||||||
* string message_id = 1;
|
|
||||||
* string user_id = 2;
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* This enables the following two alternative HTTP JSON to RPC
|
|
||||||
* mappings:
|
|
||||||
*
|
|
||||||
* HTTP | RPC
|
|
||||||
* -----|-----
|
|
||||||
* `GET /v1/messages/123456` | `GetMessage(message_id: "123456")`
|
|
||||||
* `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")`
|
|
||||||
*
|
|
||||||
* # Rules for HTTP mapping
|
|
||||||
*
|
|
||||||
* The rules for mapping HTTP path, query parameters, and body fields
|
|
||||||
* to the request message are as follows:
|
|
||||||
*
|
|
||||||
* 1. The `body` field specifies either `*` or a field path, or is
|
|
||||||
* omitted. If omitted, it indicates there is no HTTP request body.
|
|
||||||
* 2. Leaf fields (recursive expansion of nested messages in the
|
|
||||||
* request) can be classified into three types:
|
|
||||||
* (a) Matched in the URL template.
|
|
||||||
* (b) Covered by body (if body is `*`, everything except (a) fields;
|
|
||||||
* else everything under the body field)
|
|
||||||
* (c) All other fields.
|
|
||||||
* 3. URL query parameters found in the HTTP request are mapped to (c) fields.
|
|
||||||
* 4. Any body sent with an HTTP request can contain only (b) fields.
|
|
||||||
*
|
|
||||||
* The syntax of the path template is as follows:
|
|
||||||
*
|
|
||||||
* Template = "/" Segments [ Verb ] ;
|
|
||||||
* Segments = Segment { "/" Segment } ;
|
|
||||||
* Segment = "*" | "**" | LITERAL | Variable ;
|
|
||||||
* Variable = "{" FieldPath [ "=" Segments ] "}" ;
|
|
||||||
* FieldPath = IDENT { "." IDENT } ;
|
|
||||||
* Verb = ":" LITERAL ;
|
|
||||||
*
|
|
||||||
* The syntax `*` matches a single path segment. The syntax `**` matches zero
|
|
||||||
* or more path segments, which must be the last part of the path except the
|
|
||||||
* `Verb`. The syntax `LITERAL` matches literal text in the path.
|
|
||||||
*
|
|
||||||
* The syntax `Variable` matches part of the URL path as specified by its
|
|
||||||
* template. A variable template must not contain other variables. If a variable
|
|
||||||
* matches a single path segment, its template may be omitted, e.g. `{var}`
|
|
||||||
* is equivalent to `{var=*}`.
|
|
||||||
*
|
|
||||||
* If a variable contains exactly one path segment, such as `"{var}"` or
|
|
||||||
* `"{var=*}"`, when such a variable is expanded into a URL path, all characters
|
|
||||||
* except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the
|
|
||||||
* Discovery Document as `{var}`.
|
|
||||||
*
|
|
||||||
* If a variable contains one or more path segments, such as `"{var=foo/*}"`
|
|
||||||
* or `"{var=**}"`, when such a variable is expanded into a URL path, all
|
|
||||||
* characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables
|
|
||||||
* show up in the Discovery Document as `{+var}`.
|
|
||||||
*
|
|
||||||
* NOTE: While the single segment variable matches the semantics of
|
|
||||||
* [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2
|
|
||||||
* Simple String Expansion, the multi segment variable **does not** match
|
|
||||||
* RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion
|
|
||||||
* does not expand special characters like `?` and `#`, which would lead
|
|
||||||
* to invalid URLs.
|
|
||||||
*
|
|
||||||
* NOTE: the field paths in variables and in the `body` must not refer to
|
|
||||||
* repeated fields or map fields.
|
|
||||||
*/
|
|
||||||
export interface HttpRule {
|
|
||||||
/**
|
|
||||||
* Selects methods to which this rule applies.
|
|
||||||
*
|
|
||||||
* Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
|
|
||||||
*/
|
|
||||||
selector: string;
|
|
||||||
/** Used for listing and getting information about resources. */
|
|
||||||
get: string | undefined;
|
|
||||||
/** Used for updating a resource. */
|
|
||||||
put: string | undefined;
|
|
||||||
/** Used for creating a resource. */
|
|
||||||
post: string | undefined;
|
|
||||||
/** Used for deleting a resource. */
|
|
||||||
delete: string | undefined;
|
|
||||||
/** Used for updating a resource. */
|
|
||||||
patch: string | undefined;
|
|
||||||
/**
|
|
||||||
* The custom pattern is used for specifying an HTTP method that is not
|
|
||||||
* included in the `pattern` field, such as HEAD, or "*" to leave the
|
|
||||||
* HTTP method unspecified for this rule. The wild-card rule is useful
|
|
||||||
* for services that provide content to Web (HTML) clients.
|
|
||||||
*/
|
|
||||||
custom: CustomHttpPattern | undefined;
|
|
||||||
/**
|
|
||||||
* The name of the request field whose value is mapped to the HTTP body, or
|
|
||||||
* `*` for mapping all fields not captured by the path pattern to the HTTP
|
|
||||||
* body. NOTE: the referred field must not be a repeated field and must be
|
|
||||||
* present at the top-level of request message type.
|
|
||||||
*/
|
|
||||||
body: string;
|
|
||||||
/**
|
|
||||||
* Optional. The name of the response field whose value is mapped to the HTTP
|
|
||||||
* body of response. Other response fields are ignored. When
|
|
||||||
* not set, the response message will be used as HTTP body of response.
|
|
||||||
*/
|
|
||||||
response_body: string;
|
|
||||||
/**
|
|
||||||
* Additional HTTP bindings for the selector. Nested bindings must
|
|
||||||
* not contain an `additional_bindings` field themselves (that is,
|
|
||||||
* the nesting may only be one level deep).
|
|
||||||
*/
|
|
||||||
additional_bindings: HttpRule[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** A custom pattern is used for defining custom HTTP verb. */
|
|
||||||
export interface CustomHttpPattern {
|
|
||||||
/** The name of this custom HTTP verb. */
|
|
||||||
kind: string;
|
|
||||||
/** The path matched by this custom verb. */
|
|
||||||
path: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
const baseHttp: object = { fully_decode_reserved_expansion: false };
|
|
||||||
|
|
||||||
export const Http = {
|
|
||||||
encode(message: Http, writer: Writer = Writer.create()): Writer {
|
|
||||||
for (const v of message.rules) {
|
|
||||||
HttpRule.encode(v!, writer.uint32(10).fork()).ldelim();
|
|
||||||
}
|
|
||||||
if (message.fully_decode_reserved_expansion === true) {
|
|
||||||
writer.uint32(16).bool(message.fully_decode_reserved_expansion);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): Http {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseHttp } as Http;
|
|
||||||
message.rules = [];
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.rules.push(HttpRule.decode(reader, reader.uint32()));
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.fully_decode_reserved_expansion = reader.bool();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): Http {
|
|
||||||
const message = { ...baseHttp } as Http;
|
|
||||||
message.rules = [];
|
|
||||||
if (object.rules !== undefined && object.rules !== null) {
|
|
||||||
for (const e of object.rules) {
|
|
||||||
message.rules.push(HttpRule.fromJSON(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.fully_decode_reserved_expansion !== undefined &&
|
|
||||||
object.fully_decode_reserved_expansion !== null
|
|
||||||
) {
|
|
||||||
message.fully_decode_reserved_expansion = Boolean(
|
|
||||||
object.fully_decode_reserved_expansion
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
message.fully_decode_reserved_expansion = false;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: Http): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
if (message.rules) {
|
|
||||||
obj.rules = message.rules.map((e) =>
|
|
||||||
e ? HttpRule.toJSON(e) : undefined
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
obj.rules = [];
|
|
||||||
}
|
|
||||||
message.fully_decode_reserved_expansion !== undefined &&
|
|
||||||
(obj.fully_decode_reserved_expansion =
|
|
||||||
message.fully_decode_reserved_expansion);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<Http>): Http {
|
|
||||||
const message = { ...baseHttp } as Http;
|
|
||||||
message.rules = [];
|
|
||||||
if (object.rules !== undefined && object.rules !== null) {
|
|
||||||
for (const e of object.rules) {
|
|
||||||
message.rules.push(HttpRule.fromPartial(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.fully_decode_reserved_expansion !== undefined &&
|
|
||||||
object.fully_decode_reserved_expansion !== null
|
|
||||||
) {
|
|
||||||
message.fully_decode_reserved_expansion =
|
|
||||||
object.fully_decode_reserved_expansion;
|
|
||||||
} else {
|
|
||||||
message.fully_decode_reserved_expansion = false;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseHttpRule: object = { selector: "", body: "", response_body: "" };
|
|
||||||
|
|
||||||
export const HttpRule = {
|
|
||||||
encode(message: HttpRule, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.selector !== "") {
|
|
||||||
writer.uint32(10).string(message.selector);
|
|
||||||
}
|
|
||||||
if (message.get !== undefined) {
|
|
||||||
writer.uint32(18).string(message.get);
|
|
||||||
}
|
|
||||||
if (message.put !== undefined) {
|
|
||||||
writer.uint32(26).string(message.put);
|
|
||||||
}
|
|
||||||
if (message.post !== undefined) {
|
|
||||||
writer.uint32(34).string(message.post);
|
|
||||||
}
|
|
||||||
if (message.delete !== undefined) {
|
|
||||||
writer.uint32(42).string(message.delete);
|
|
||||||
}
|
|
||||||
if (message.patch !== undefined) {
|
|
||||||
writer.uint32(50).string(message.patch);
|
|
||||||
}
|
|
||||||
if (message.custom !== undefined) {
|
|
||||||
CustomHttpPattern.encode(
|
|
||||||
message.custom,
|
|
||||||
writer.uint32(66).fork()
|
|
||||||
).ldelim();
|
|
||||||
}
|
|
||||||
if (message.body !== "") {
|
|
||||||
writer.uint32(58).string(message.body);
|
|
||||||
}
|
|
||||||
if (message.response_body !== "") {
|
|
||||||
writer.uint32(98).string(message.response_body);
|
|
||||||
}
|
|
||||||
for (const v of message.additional_bindings) {
|
|
||||||
HttpRule.encode(v!, writer.uint32(90).fork()).ldelim();
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): HttpRule {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseHttpRule } as HttpRule;
|
|
||||||
message.additional_bindings = [];
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.selector = reader.string();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.get = reader.string();
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
message.put = reader.string();
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
message.post = reader.string();
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
message.delete = reader.string();
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
message.patch = reader.string();
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
message.custom = CustomHttpPattern.decode(reader, reader.uint32());
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
message.body = reader.string();
|
|
||||||
break;
|
|
||||||
case 12:
|
|
||||||
message.response_body = reader.string();
|
|
||||||
break;
|
|
||||||
case 11:
|
|
||||||
message.additional_bindings.push(
|
|
||||||
HttpRule.decode(reader, reader.uint32())
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): HttpRule {
|
|
||||||
const message = { ...baseHttpRule } as HttpRule;
|
|
||||||
message.additional_bindings = [];
|
|
||||||
if (object.selector !== undefined && object.selector !== null) {
|
|
||||||
message.selector = String(object.selector);
|
|
||||||
} else {
|
|
||||||
message.selector = "";
|
|
||||||
}
|
|
||||||
if (object.get !== undefined && object.get !== null) {
|
|
||||||
message.get = String(object.get);
|
|
||||||
} else {
|
|
||||||
message.get = undefined;
|
|
||||||
}
|
|
||||||
if (object.put !== undefined && object.put !== null) {
|
|
||||||
message.put = String(object.put);
|
|
||||||
} else {
|
|
||||||
message.put = undefined;
|
|
||||||
}
|
|
||||||
if (object.post !== undefined && object.post !== null) {
|
|
||||||
message.post = String(object.post);
|
|
||||||
} else {
|
|
||||||
message.post = undefined;
|
|
||||||
}
|
|
||||||
if (object.delete !== undefined && object.delete !== null) {
|
|
||||||
message.delete = String(object.delete);
|
|
||||||
} else {
|
|
||||||
message.delete = undefined;
|
|
||||||
}
|
|
||||||
if (object.patch !== undefined && object.patch !== null) {
|
|
||||||
message.patch = String(object.patch);
|
|
||||||
} else {
|
|
||||||
message.patch = undefined;
|
|
||||||
}
|
|
||||||
if (object.custom !== undefined && object.custom !== null) {
|
|
||||||
message.custom = CustomHttpPattern.fromJSON(object.custom);
|
|
||||||
} else {
|
|
||||||
message.custom = undefined;
|
|
||||||
}
|
|
||||||
if (object.body !== undefined && object.body !== null) {
|
|
||||||
message.body = String(object.body);
|
|
||||||
} else {
|
|
||||||
message.body = "";
|
|
||||||
}
|
|
||||||
if (object.response_body !== undefined && object.response_body !== null) {
|
|
||||||
message.response_body = String(object.response_body);
|
|
||||||
} else {
|
|
||||||
message.response_body = "";
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.additional_bindings !== undefined &&
|
|
||||||
object.additional_bindings !== null
|
|
||||||
) {
|
|
||||||
for (const e of object.additional_bindings) {
|
|
||||||
message.additional_bindings.push(HttpRule.fromJSON(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: HttpRule): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.selector !== undefined && (obj.selector = message.selector);
|
|
||||||
message.get !== undefined && (obj.get = message.get);
|
|
||||||
message.put !== undefined && (obj.put = message.put);
|
|
||||||
message.post !== undefined && (obj.post = message.post);
|
|
||||||
message.delete !== undefined && (obj.delete = message.delete);
|
|
||||||
message.patch !== undefined && (obj.patch = message.patch);
|
|
||||||
message.custom !== undefined &&
|
|
||||||
(obj.custom = message.custom
|
|
||||||
? CustomHttpPattern.toJSON(message.custom)
|
|
||||||
: undefined);
|
|
||||||
message.body !== undefined && (obj.body = message.body);
|
|
||||||
message.response_body !== undefined &&
|
|
||||||
(obj.response_body = message.response_body);
|
|
||||||
if (message.additional_bindings) {
|
|
||||||
obj.additional_bindings = message.additional_bindings.map((e) =>
|
|
||||||
e ? HttpRule.toJSON(e) : undefined
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
obj.additional_bindings = [];
|
|
||||||
}
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<HttpRule>): HttpRule {
|
|
||||||
const message = { ...baseHttpRule } as HttpRule;
|
|
||||||
message.additional_bindings = [];
|
|
||||||
if (object.selector !== undefined && object.selector !== null) {
|
|
||||||
message.selector = object.selector;
|
|
||||||
} else {
|
|
||||||
message.selector = "";
|
|
||||||
}
|
|
||||||
if (object.get !== undefined && object.get !== null) {
|
|
||||||
message.get = object.get;
|
|
||||||
} else {
|
|
||||||
message.get = undefined;
|
|
||||||
}
|
|
||||||
if (object.put !== undefined && object.put !== null) {
|
|
||||||
message.put = object.put;
|
|
||||||
} else {
|
|
||||||
message.put = undefined;
|
|
||||||
}
|
|
||||||
if (object.post !== undefined && object.post !== null) {
|
|
||||||
message.post = object.post;
|
|
||||||
} else {
|
|
||||||
message.post = undefined;
|
|
||||||
}
|
|
||||||
if (object.delete !== undefined && object.delete !== null) {
|
|
||||||
message.delete = object.delete;
|
|
||||||
} else {
|
|
||||||
message.delete = undefined;
|
|
||||||
}
|
|
||||||
if (object.patch !== undefined && object.patch !== null) {
|
|
||||||
message.patch = object.patch;
|
|
||||||
} else {
|
|
||||||
message.patch = undefined;
|
|
||||||
}
|
|
||||||
if (object.custom !== undefined && object.custom !== null) {
|
|
||||||
message.custom = CustomHttpPattern.fromPartial(object.custom);
|
|
||||||
} else {
|
|
||||||
message.custom = undefined;
|
|
||||||
}
|
|
||||||
if (object.body !== undefined && object.body !== null) {
|
|
||||||
message.body = object.body;
|
|
||||||
} else {
|
|
||||||
message.body = "";
|
|
||||||
}
|
|
||||||
if (object.response_body !== undefined && object.response_body !== null) {
|
|
||||||
message.response_body = object.response_body;
|
|
||||||
} else {
|
|
||||||
message.response_body = "";
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.additional_bindings !== undefined &&
|
|
||||||
object.additional_bindings !== null
|
|
||||||
) {
|
|
||||||
for (const e of object.additional_bindings) {
|
|
||||||
message.additional_bindings.push(HttpRule.fromPartial(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseCustomHttpPattern: object = { kind: "", path: "" };
|
|
||||||
|
|
||||||
export const CustomHttpPattern = {
|
|
||||||
encode(message: CustomHttpPattern, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.kind !== "") {
|
|
||||||
writer.uint32(10).string(message.kind);
|
|
||||||
}
|
|
||||||
if (message.path !== "") {
|
|
||||||
writer.uint32(18).string(message.path);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): CustomHttpPattern {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseCustomHttpPattern } as CustomHttpPattern;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.kind = reader.string();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.path = reader.string();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): CustomHttpPattern {
|
|
||||||
const message = { ...baseCustomHttpPattern } as CustomHttpPattern;
|
|
||||||
if (object.kind !== undefined && object.kind !== null) {
|
|
||||||
message.kind = String(object.kind);
|
|
||||||
} else {
|
|
||||||
message.kind = "";
|
|
||||||
}
|
|
||||||
if (object.path !== undefined && object.path !== null) {
|
|
||||||
message.path = String(object.path);
|
|
||||||
} else {
|
|
||||||
message.path = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: CustomHttpPattern): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.kind !== undefined && (obj.kind = message.kind);
|
|
||||||
message.path !== undefined && (obj.path = message.path);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<CustomHttpPattern>): CustomHttpPattern {
|
|
||||||
const message = { ...baseCustomHttpPattern } as CustomHttpPattern;
|
|
||||||
if (object.kind !== undefined && object.kind !== null) {
|
|
||||||
message.kind = object.kind;
|
|
||||||
} else {
|
|
||||||
message.kind = "";
|
|
||||||
}
|
|
||||||
if (object.path !== undefined && object.path !== null) {
|
|
||||||
message.path = object.path;
|
|
||||||
} else {
|
|
||||||
message.path = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
||||||
export type DeepPartial<T> = T extends Builtin
|
|
||||||
? T
|
|
||||||
: T extends Array<infer U>
|
|
||||||
? Array<DeepPartial<U>>
|
|
||||||
: T extends ReadonlyArray<infer U>
|
|
||||||
? ReadonlyArray<DeepPartial<U>>
|
|
||||||
: T extends {}
|
|
||||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
||||||
: Partial<T>;
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,18 +0,0 @@
|
||||||
{
|
|
||||||
"name": "cosmostest-cosmostest-js",
|
|
||||||
"version": "0.1.0",
|
|
||||||
"description": "Autogenerated vuex store for Cosmos module cosmostest.cosmostest",
|
|
||||||
"author": "Starport Codegen <hello@tendermint.com>",
|
|
||||||
"homepage": "http://cosmos-test/x/cosmostest/types",
|
|
||||||
"license": "Apache-2.0",
|
|
||||||
"licenses": [
|
|
||||||
{
|
|
||||||
"type": "Apache-2.0",
|
|
||||||
"url": "http://www.apache.org/licenses/LICENSE-2.0"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"main": "index.js",
|
|
||||||
"publishConfig": {
|
|
||||||
"access": "public"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
THIS FILE IS GENERATED AUTOMATICALLY. DO NOT DELETE.
|
|
|
@ -1,207 +0,0 @@
|
||||||
import { txClient, queryClient, MissingWalletError , registry} from './module'
|
|
||||||
|
|
||||||
import { BaseAccount } from "./module/types/cosmos/auth/v1beta1/auth"
|
|
||||||
import { ModuleAccount } from "./module/types/cosmos/auth/v1beta1/auth"
|
|
||||||
import { Params } from "./module/types/cosmos/auth/v1beta1/auth"
|
|
||||||
|
|
||||||
|
|
||||||
export { BaseAccount, ModuleAccount, Params };
|
|
||||||
|
|
||||||
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 {
|
|
||||||
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 queryClient=await initQueryClient(rootGetters)
|
|
||||||
let value= (await queryClient.queryAccounts(query)).data
|
|
||||||
|
|
||||||
|
|
||||||
while (all && (<any> value).pagination && (<any> value).pagination.next_key!=null) {
|
|
||||||
let next_values=(await queryClient.queryAccounts({...query, 'pagination.key':(<any> value).pagination.next_key})).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 queryClient=await initQueryClient(rootGetters)
|
|
||||||
let value= (await queryClient.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 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 Error('QueryClient:QueryParams API Node Unavailable. Could not perform query: ' + e.message)
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,57 +0,0 @@
|
||||||
// THIS FILE IS GENERATED AUTOMATICALLY. DO NOT MODIFY.
|
|
||||||
|
|
||||||
import { StdFee } from "@cosmjs/launchpad";
|
|
||||||
import { SigningStargateClient } from "@cosmjs/stargate";
|
|
||||||
import { Registry, OfflineSigner, EncodeObject, DirectSecp256k1HdWallet } from "@cosmjs/proto-signing";
|
|
||||||
import { Api } from "./rest";
|
|
||||||
|
|
||||||
|
|
||||||
const types = [
|
|
||||||
|
|
||||||
];
|
|
||||||
export const MissingWalletError = new Error("wallet is required");
|
|
||||||
|
|
||||||
export const registry = new Registry(<any>types);
|
|
||||||
|
|
||||||
const defaultFee = {
|
|
||||||
amount: [],
|
|
||||||
gas: "200000",
|
|
||||||
};
|
|
||||||
|
|
||||||
interface TxClientOptions {
|
|
||||||
addr: string
|
|
||||||
}
|
|
||||||
|
|
||||||
interface SignAndBroadcastOptions {
|
|
||||||
fee: StdFee,
|
|
||||||
memo?: string
|
|
||||||
}
|
|
||||||
|
|
||||||
const txClient = async (wallet: OfflineSigner, { addr: addr }: TxClientOptions = { addr: "http://localhost:26657" }) => {
|
|
||||||
if (!wallet) throw MissingWalletError;
|
|
||||||
let client;
|
|
||||||
if (addr) {
|
|
||||||
client = await SigningStargateClient.connectWithSigner(addr, wallet, { registry });
|
|
||||||
}else{
|
|
||||||
client = await SigningStargateClient.offline( wallet, { registry });
|
|
||||||
}
|
|
||||||
const { address } = (await wallet.getAccounts())[0];
|
|
||||||
|
|
||||||
return {
|
|
||||||
signAndBroadcast: (msgs: EncodeObject[], { fee, memo }: SignAndBroadcastOptions = {fee: defaultFee, memo: ""}) => client.signAndBroadcast(address, msgs, fee,memo),
|
|
||||||
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
interface QueryClientOptions {
|
|
||||||
addr: string
|
|
||||||
}
|
|
||||||
|
|
||||||
const queryClient = async ({ addr: addr }: QueryClientOptions = { addr: "http://localhost:1317" }) => {
|
|
||||||
return new Api({ baseUrl: addr });
|
|
||||||
};
|
|
||||||
|
|
||||||
export {
|
|
||||||
txClient,
|
|
||||||
queryClient,
|
|
||||||
};
|
|
|
@ -1,500 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
/* tslint:disable */
|
|
||||||
/*
|
|
||||||
* ---------------------------------------------------------------
|
|
||||||
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
|
|
||||||
* ## ##
|
|
||||||
* ## AUTHOR: acacode ##
|
|
||||||
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
|
|
||||||
* ---------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* `Any` contains an arbitrary serialized protocol buffer message along with a
|
|
||||||
URL that describes the type of the serialized message.
|
|
||||||
|
|
||||||
Protobuf library provides support to pack/unpack Any values in the form
|
|
||||||
of utility functions or additional generated methods of the Any type.
|
|
||||||
|
|
||||||
Example 1: Pack and unpack a message in C++.
|
|
||||||
|
|
||||||
Foo foo = ...;
|
|
||||||
Any any;
|
|
||||||
any.PackFrom(foo);
|
|
||||||
...
|
|
||||||
if (any.UnpackTo(&foo)) {
|
|
||||||
...
|
|
||||||
}
|
|
||||||
|
|
||||||
Example 2: Pack and unpack a message in Java.
|
|
||||||
|
|
||||||
Foo foo = ...;
|
|
||||||
Any any = Any.pack(foo);
|
|
||||||
...
|
|
||||||
if (any.is(Foo.class)) {
|
|
||||||
foo = any.unpack(Foo.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
Example 3: Pack and unpack a message in Python.
|
|
||||||
|
|
||||||
foo = Foo(...)
|
|
||||||
any = Any()
|
|
||||||
any.Pack(foo)
|
|
||||||
...
|
|
||||||
if any.Is(Foo.DESCRIPTOR):
|
|
||||||
any.Unpack(foo)
|
|
||||||
...
|
|
||||||
|
|
||||||
Example 4: Pack and unpack a message in Go
|
|
||||||
|
|
||||||
foo := &pb.Foo{...}
|
|
||||||
any, err := anypb.New(foo)
|
|
||||||
if err != nil {
|
|
||||||
...
|
|
||||||
}
|
|
||||||
...
|
|
||||||
foo := &pb.Foo{}
|
|
||||||
if err := any.UnmarshalTo(foo); err != nil {
|
|
||||||
...
|
|
||||||
}
|
|
||||||
|
|
||||||
The pack methods provided by protobuf library will by default use
|
|
||||||
'type.googleapis.com/full.type.name' as the type URL and the unpack
|
|
||||||
methods only use the fully qualified type name after the last '/'
|
|
||||||
in the type URL, for example "foo.bar.com/x/y.z" will yield type
|
|
||||||
name "y.z".
|
|
||||||
|
|
||||||
|
|
||||||
JSON
|
|
||||||
====
|
|
||||||
The JSON representation of an `Any` value uses the regular
|
|
||||||
representation of the deserialized, embedded message, with an
|
|
||||||
additional field `@type` which contains the type URL. Example:
|
|
||||||
|
|
||||||
package google.profile;
|
|
||||||
message Person {
|
|
||||||
string first_name = 1;
|
|
||||||
string last_name = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
"@type": "type.googleapis.com/google.profile.Person",
|
|
||||||
"firstName": <string>,
|
|
||||||
"lastName": <string>
|
|
||||||
}
|
|
||||||
|
|
||||||
If the embedded message type is well-known and has a custom JSON
|
|
||||||
representation, that representation will be embedded adding a field
|
|
||||||
`value` which holds the custom JSON in addition to the `@type`
|
|
||||||
field. Example (for message [google.protobuf.Duration][]):
|
|
||||||
|
|
||||||
{
|
|
||||||
"@type": "type.googleapis.com/google.protobuf.Duration",
|
|
||||||
"value": "1.212s"
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
export interface ProtobufAny {
|
|
||||||
/**
|
|
||||||
* A URL/resource name that uniquely identifies the type of the serialized
|
|
||||||
* protocol buffer message. This string must contain at least
|
|
||||||
* one "/" character. The last segment of the URL's path must represent
|
|
||||||
* the fully qualified name of the type (as in
|
|
||||||
* `path/google.protobuf.Duration`). The name should be in a canonical form
|
|
||||||
* (e.g., leading "." is not accepted).
|
|
||||||
*
|
|
||||||
* In practice, teams usually precompile into the binary all types that they
|
|
||||||
* expect it to use in the context of Any. However, for URLs which use the
|
|
||||||
* scheme `http`, `https`, or no scheme, one can optionally set up a type
|
|
||||||
* server that maps type URLs to message definitions as follows:
|
|
||||||
*
|
|
||||||
* * If no scheme is provided, `https` is assumed.
|
|
||||||
* * An HTTP GET on the URL must yield a [google.protobuf.Type][]
|
|
||||||
* value in binary format, or produce an error.
|
|
||||||
* * Applications are allowed to cache lookup results based on the
|
|
||||||
* URL, or have them precompiled into a binary to avoid any
|
|
||||||
* lookup. Therefore, binary compatibility needs to be preserved
|
|
||||||
* on changes to types. (Use versioned type names to manage
|
|
||||||
* breaking changes.)
|
|
||||||
*
|
|
||||||
* Note: this functionality is not currently available in the official
|
|
||||||
* protobuf release, and it is not used for type URLs beginning with
|
|
||||||
* type.googleapis.com.
|
|
||||||
*
|
|
||||||
* Schemes other than `http`, `https` (or the empty scheme) might be
|
|
||||||
* used with implementation specific semantics.
|
|
||||||
*/
|
|
||||||
"@type"?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface RpcStatus {
|
|
||||||
/** @format int32 */
|
|
||||||
code?: number;
|
|
||||||
message?: string;
|
|
||||||
details?: ProtobufAny[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* message SomeRequest {
|
|
||||||
Foo some_parameter = 1;
|
|
||||||
PageRequest pagination = 2;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
export interface V1Beta1PageRequest {
|
|
||||||
/**
|
|
||||||
* key is a value returned in PageResponse.next_key to begin
|
|
||||||
* querying the next page most efficiently. Only one of offset or key
|
|
||||||
* should be set.
|
|
||||||
* @format byte
|
|
||||||
*/
|
|
||||||
key?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* offset is a numeric offset that can be used when key is unavailable.
|
|
||||||
* It is less efficient than using key. Only one of offset or key should
|
|
||||||
* be set.
|
|
||||||
* @format uint64
|
|
||||||
*/
|
|
||||||
offset?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* limit is the total number of results to be returned in the result page.
|
|
||||||
* If left empty it will default to a value to be set by each app.
|
|
||||||
* @format uint64
|
|
||||||
*/
|
|
||||||
limit?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* count_total is set to true to indicate that the result set should include
|
|
||||||
* a count of the total number of items available for pagination in UIs.
|
|
||||||
* count_total is only respected when offset is used. It is ignored when key
|
|
||||||
* is set.
|
|
||||||
*/
|
|
||||||
count_total?: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* reverse is set to true if results are to be returned in the descending order.
|
|
||||||
*
|
|
||||||
* Since: cosmos-sdk 0.43
|
|
||||||
*/
|
|
||||||
reverse?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PageResponse is to be embedded in gRPC response messages where the
|
|
||||||
corresponding request message has used PageRequest.
|
|
||||||
|
|
||||||
message SomeResponse {
|
|
||||||
repeated Bar results = 1;
|
|
||||||
PageResponse page = 2;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
export interface V1Beta1PageResponse {
|
|
||||||
/** @format byte */
|
|
||||||
next_key?: string;
|
|
||||||
|
|
||||||
/** @format uint64 */
|
|
||||||
total?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Params defines the parameters for the auth module.
|
|
||||||
*/
|
|
||||||
export interface V1Beta1Params {
|
|
||||||
/** @format uint64 */
|
|
||||||
max_memo_characters?: string;
|
|
||||||
|
|
||||||
/** @format uint64 */
|
|
||||||
tx_sig_limit?: string;
|
|
||||||
|
|
||||||
/** @format uint64 */
|
|
||||||
tx_size_cost_per_byte?: string;
|
|
||||||
|
|
||||||
/** @format uint64 */
|
|
||||||
sig_verify_cost_ed25519?: string;
|
|
||||||
|
|
||||||
/** @format uint64 */
|
|
||||||
sig_verify_cost_secp256k1?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* QueryAccountResponse is the response type for the Query/Account RPC method.
|
|
||||||
*/
|
|
||||||
export interface V1Beta1QueryAccountResponse {
|
|
||||||
/** account defines the account of the corresponding address. */
|
|
||||||
account?: ProtobufAny;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* QueryAccountsResponse is the response type for the Query/Accounts RPC method.
|
|
||||||
|
|
||||||
Since: cosmos-sdk 0.43
|
|
||||||
*/
|
|
||||||
export interface V1Beta1QueryAccountsResponse {
|
|
||||||
accounts?: ProtobufAny[];
|
|
||||||
|
|
||||||
/** pagination defines the pagination in the response. */
|
|
||||||
pagination?: V1Beta1PageResponse;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* QueryParamsResponse is the response type for the Query/Params RPC method.
|
|
||||||
*/
|
|
||||||
export interface V1Beta1QueryParamsResponse {
|
|
||||||
/** params defines the parameters of the module. */
|
|
||||||
params?: V1Beta1Params;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type QueryParamsType = Record<string | number, any>;
|
|
||||||
export type ResponseFormat = keyof Omit<Body, "body" | "bodyUsed">;
|
|
||||||
|
|
||||||
export interface FullRequestParams extends Omit<RequestInit, "body"> {
|
|
||||||
/** set parameter to `true` for call `securityWorker` for this request */
|
|
||||||
secure?: boolean;
|
|
||||||
/** request path */
|
|
||||||
path: string;
|
|
||||||
/** content type of request body */
|
|
||||||
type?: ContentType;
|
|
||||||
/** query params */
|
|
||||||
query?: QueryParamsType;
|
|
||||||
/** format of response (i.e. response.json() -> format: "json") */
|
|
||||||
format?: keyof Omit<Body, "body" | "bodyUsed">;
|
|
||||||
/** request body */
|
|
||||||
body?: unknown;
|
|
||||||
/** base url */
|
|
||||||
baseUrl?: string;
|
|
||||||
/** request cancellation token */
|
|
||||||
cancelToken?: CancelToken;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type RequestParams = Omit<FullRequestParams, "body" | "method" | "query" | "path">;
|
|
||||||
|
|
||||||
export interface ApiConfig<SecurityDataType = unknown> {
|
|
||||||
baseUrl?: string;
|
|
||||||
baseApiParams?: Omit<RequestParams, "baseUrl" | "cancelToken" | "signal">;
|
|
||||||
securityWorker?: (securityData: SecurityDataType) => RequestParams | void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
|
|
||||||
data: D;
|
|
||||||
error: E;
|
|
||||||
}
|
|
||||||
|
|
||||||
type CancelToken = Symbol | string | number;
|
|
||||||
|
|
||||||
export enum ContentType {
|
|
||||||
Json = "application/json",
|
|
||||||
FormData = "multipart/form-data",
|
|
||||||
UrlEncoded = "application/x-www-form-urlencoded",
|
|
||||||
}
|
|
||||||
|
|
||||||
export class HttpClient<SecurityDataType = unknown> {
|
|
||||||
public baseUrl: string = "";
|
|
||||||
private securityData: SecurityDataType = null as any;
|
|
||||||
private securityWorker: null | ApiConfig<SecurityDataType>["securityWorker"] = null;
|
|
||||||
private abortControllers = new Map<CancelToken, AbortController>();
|
|
||||||
|
|
||||||
private baseApiParams: RequestParams = {
|
|
||||||
credentials: "same-origin",
|
|
||||||
headers: {},
|
|
||||||
redirect: "follow",
|
|
||||||
referrerPolicy: "no-referrer",
|
|
||||||
};
|
|
||||||
|
|
||||||
constructor(apiConfig: ApiConfig<SecurityDataType> = {}) {
|
|
||||||
Object.assign(this, apiConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
public setSecurityData = (data: SecurityDataType) => {
|
|
||||||
this.securityData = data;
|
|
||||||
};
|
|
||||||
|
|
||||||
private addQueryParam(query: QueryParamsType, key: string) {
|
|
||||||
const value = query[key];
|
|
||||||
|
|
||||||
return (
|
|
||||||
encodeURIComponent(key) +
|
|
||||||
"=" +
|
|
||||||
encodeURIComponent(Array.isArray(value) ? value.join(",") : typeof value === "number" ? value : `${value}`)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected toQueryString(rawQuery?: QueryParamsType): string {
|
|
||||||
const query = rawQuery || {};
|
|
||||||
const keys = Object.keys(query).filter((key) => "undefined" !== typeof query[key]);
|
|
||||||
return keys
|
|
||||||
.map((key) =>
|
|
||||||
typeof query[key] === "object" && !Array.isArray(query[key])
|
|
||||||
? this.toQueryString(query[key] as QueryParamsType)
|
|
||||||
: this.addQueryParam(query, key),
|
|
||||||
)
|
|
||||||
.join("&");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected addQueryParams(rawQuery?: QueryParamsType): string {
|
|
||||||
const queryString = this.toQueryString(rawQuery);
|
|
||||||
return queryString ? `?${queryString}` : "";
|
|
||||||
}
|
|
||||||
|
|
||||||
private contentFormatters: Record<ContentType, (input: any) => any> = {
|
|
||||||
[ContentType.Json]: (input: any) =>
|
|
||||||
input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input,
|
|
||||||
[ContentType.FormData]: (input: any) =>
|
|
||||||
Object.keys(input || {}).reduce((data, key) => {
|
|
||||||
data.append(key, input[key]);
|
|
||||||
return data;
|
|
||||||
}, new FormData()),
|
|
||||||
[ContentType.UrlEncoded]: (input: any) => this.toQueryString(input),
|
|
||||||
};
|
|
||||||
|
|
||||||
private mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams {
|
|
||||||
return {
|
|
||||||
...this.baseApiParams,
|
|
||||||
...params1,
|
|
||||||
...(params2 || {}),
|
|
||||||
headers: {
|
|
||||||
...(this.baseApiParams.headers || {}),
|
|
||||||
...(params1.headers || {}),
|
|
||||||
...((params2 && params2.headers) || {}),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private createAbortSignal = (cancelToken: CancelToken): AbortSignal | undefined => {
|
|
||||||
if (this.abortControllers.has(cancelToken)) {
|
|
||||||
const abortController = this.abortControllers.get(cancelToken);
|
|
||||||
if (abortController) {
|
|
||||||
return abortController.signal;
|
|
||||||
}
|
|
||||||
return void 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const abortController = new AbortController();
|
|
||||||
this.abortControllers.set(cancelToken, abortController);
|
|
||||||
return abortController.signal;
|
|
||||||
};
|
|
||||||
|
|
||||||
public abortRequest = (cancelToken: CancelToken) => {
|
|
||||||
const abortController = this.abortControllers.get(cancelToken);
|
|
||||||
|
|
||||||
if (abortController) {
|
|
||||||
abortController.abort();
|
|
||||||
this.abortControllers.delete(cancelToken);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public request = <T = any, E = any>({
|
|
||||||
body,
|
|
||||||
secure,
|
|
||||||
path,
|
|
||||||
type,
|
|
||||||
query,
|
|
||||||
format = "json",
|
|
||||||
baseUrl,
|
|
||||||
cancelToken,
|
|
||||||
...params
|
|
||||||
}: FullRequestParams): Promise<HttpResponse<T, E>> => {
|
|
||||||
const secureParams = (secure && this.securityWorker && this.securityWorker(this.securityData)) || {};
|
|
||||||
const requestParams = this.mergeRequestParams(params, secureParams);
|
|
||||||
const queryString = query && this.toQueryString(query);
|
|
||||||
const payloadFormatter = this.contentFormatters[type || ContentType.Json];
|
|
||||||
|
|
||||||
return fetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, {
|
|
||||||
...requestParams,
|
|
||||||
headers: {
|
|
||||||
...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}),
|
|
||||||
...(requestParams.headers || {}),
|
|
||||||
},
|
|
||||||
signal: cancelToken ? this.createAbortSignal(cancelToken) : void 0,
|
|
||||||
body: typeof body === "undefined" || body === null ? null : payloadFormatter(body),
|
|
||||||
}).then(async (response) => {
|
|
||||||
const r = response as HttpResponse<T, E>;
|
|
||||||
r.data = (null as unknown) as T;
|
|
||||||
r.error = (null as unknown) as E;
|
|
||||||
|
|
||||||
const data = await response[format]()
|
|
||||||
.then((data) => {
|
|
||||||
if (r.ok) {
|
|
||||||
r.data = data;
|
|
||||||
} else {
|
|
||||||
r.error = data;
|
|
||||||
}
|
|
||||||
return r;
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
r.error = e;
|
|
||||||
return r;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (cancelToken) {
|
|
||||||
this.abortControllers.delete(cancelToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!response.ok) throw data;
|
|
||||||
return data;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @title cosmos/auth/v1beta1/auth.proto
|
|
||||||
* @version version not set
|
|
||||||
*/
|
|
||||||
export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
|
|
||||||
/**
|
|
||||||
* @description Since: cosmos-sdk 0.43
|
|
||||||
*
|
|
||||||
* @tags Query
|
|
||||||
* @name QueryAccounts
|
|
||||||
* @summary Accounts returns all the existing accounts
|
|
||||||
* @request GET:/cosmos/auth/v1beta1/accounts
|
|
||||||
*/
|
|
||||||
queryAccounts = (
|
|
||||||
query?: {
|
|
||||||
"pagination.key"?: string;
|
|
||||||
"pagination.offset"?: string;
|
|
||||||
"pagination.limit"?: string;
|
|
||||||
"pagination.count_total"?: boolean;
|
|
||||||
"pagination.reverse"?: boolean;
|
|
||||||
},
|
|
||||||
params: RequestParams = {},
|
|
||||||
) =>
|
|
||||||
this.request<V1Beta1QueryAccountsResponse, RpcStatus>({
|
|
||||||
path: `/cosmos/auth/v1beta1/accounts`,
|
|
||||||
method: "GET",
|
|
||||||
query: query,
|
|
||||||
format: "json",
|
|
||||||
...params,
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* No description
|
|
||||||
*
|
|
||||||
* @tags Query
|
|
||||||
* @name QueryAccount
|
|
||||||
* @summary Account returns account details based on address.
|
|
||||||
* @request GET:/cosmos/auth/v1beta1/accounts/{address}
|
|
||||||
*/
|
|
||||||
queryAccount = (address: string, params: RequestParams = {}) =>
|
|
||||||
this.request<V1Beta1QueryAccountResponse, RpcStatus>({
|
|
||||||
path: `/cosmos/auth/v1beta1/accounts/${address}`,
|
|
||||||
method: "GET",
|
|
||||||
format: "json",
|
|
||||||
...params,
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* No description
|
|
||||||
*
|
|
||||||
* @tags Query
|
|
||||||
* @name QueryParams
|
|
||||||
* @summary Params queries all parameters.
|
|
||||||
* @request GET:/cosmos/auth/v1beta1/params
|
|
||||||
*/
|
|
||||||
queryParams = (params: RequestParams = {}) =>
|
|
||||||
this.request<V1Beta1QueryParamsResponse, RpcStatus>({
|
|
||||||
path: `/cosmos/auth/v1beta1/params`,
|
|
||||||
method: "GET",
|
|
||||||
format: "json",
|
|
||||||
...params,
|
|
||||||
});
|
|
||||||
}
|
|
|
@ -1,441 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import * as Long from "long";
|
|
||||||
import { util, configure, Writer, Reader } from "protobufjs/minimal";
|
|
||||||
import { Any } from "../../../google/protobuf/any";
|
|
||||||
|
|
||||||
export const protobufPackage = "cosmos.auth.v1beta1";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* BaseAccount defines a base account type. It contains all the necessary fields
|
|
||||||
* for basic account functionality. Any custom account type should extend this
|
|
||||||
* type for additional functionality (e.g. vesting).
|
|
||||||
*/
|
|
||||||
export interface BaseAccount {
|
|
||||||
address: string;
|
|
||||||
pub_key: Any | undefined;
|
|
||||||
account_number: number;
|
|
||||||
sequence: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** ModuleAccount defines an account for modules that holds coins on a pool. */
|
|
||||||
export interface ModuleAccount {
|
|
||||||
base_account: BaseAccount | undefined;
|
|
||||||
name: string;
|
|
||||||
permissions: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Params defines the parameters for the auth module. */
|
|
||||||
export interface Params {
|
|
||||||
max_memo_characters: number;
|
|
||||||
tx_sig_limit: number;
|
|
||||||
tx_size_cost_per_byte: number;
|
|
||||||
sig_verify_cost_ed25519: number;
|
|
||||||
sig_verify_cost_secp256k1: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
const baseBaseAccount: object = { address: "", account_number: 0, sequence: 0 };
|
|
||||||
|
|
||||||
export const BaseAccount = {
|
|
||||||
encode(message: BaseAccount, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.address !== "") {
|
|
||||||
writer.uint32(10).string(message.address);
|
|
||||||
}
|
|
||||||
if (message.pub_key !== undefined) {
|
|
||||||
Any.encode(message.pub_key, writer.uint32(18).fork()).ldelim();
|
|
||||||
}
|
|
||||||
if (message.account_number !== 0) {
|
|
||||||
writer.uint32(24).uint64(message.account_number);
|
|
||||||
}
|
|
||||||
if (message.sequence !== 0) {
|
|
||||||
writer.uint32(32).uint64(message.sequence);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): BaseAccount {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseBaseAccount } as BaseAccount;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.address = reader.string();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.pub_key = Any.decode(reader, reader.uint32());
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
message.account_number = longToNumber(reader.uint64() as Long);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
message.sequence = longToNumber(reader.uint64() as Long);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): BaseAccount {
|
|
||||||
const message = { ...baseBaseAccount } as BaseAccount;
|
|
||||||
if (object.address !== undefined && object.address !== null) {
|
|
||||||
message.address = String(object.address);
|
|
||||||
} else {
|
|
||||||
message.address = "";
|
|
||||||
}
|
|
||||||
if (object.pub_key !== undefined && object.pub_key !== null) {
|
|
||||||
message.pub_key = Any.fromJSON(object.pub_key);
|
|
||||||
} else {
|
|
||||||
message.pub_key = undefined;
|
|
||||||
}
|
|
||||||
if (object.account_number !== undefined && object.account_number !== null) {
|
|
||||||
message.account_number = Number(object.account_number);
|
|
||||||
} else {
|
|
||||||
message.account_number = 0;
|
|
||||||
}
|
|
||||||
if (object.sequence !== undefined && object.sequence !== null) {
|
|
||||||
message.sequence = Number(object.sequence);
|
|
||||||
} else {
|
|
||||||
message.sequence = 0;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: BaseAccount): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.address !== undefined && (obj.address = message.address);
|
|
||||||
message.pub_key !== undefined &&
|
|
||||||
(obj.pub_key = message.pub_key ? Any.toJSON(message.pub_key) : undefined);
|
|
||||||
message.account_number !== undefined &&
|
|
||||||
(obj.account_number = message.account_number);
|
|
||||||
message.sequence !== undefined && (obj.sequence = message.sequence);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<BaseAccount>): BaseAccount {
|
|
||||||
const message = { ...baseBaseAccount } as BaseAccount;
|
|
||||||
if (object.address !== undefined && object.address !== null) {
|
|
||||||
message.address = object.address;
|
|
||||||
} else {
|
|
||||||
message.address = "";
|
|
||||||
}
|
|
||||||
if (object.pub_key !== undefined && object.pub_key !== null) {
|
|
||||||
message.pub_key = Any.fromPartial(object.pub_key);
|
|
||||||
} else {
|
|
||||||
message.pub_key = undefined;
|
|
||||||
}
|
|
||||||
if (object.account_number !== undefined && object.account_number !== null) {
|
|
||||||
message.account_number = object.account_number;
|
|
||||||
} else {
|
|
||||||
message.account_number = 0;
|
|
||||||
}
|
|
||||||
if (object.sequence !== undefined && object.sequence !== null) {
|
|
||||||
message.sequence = object.sequence;
|
|
||||||
} else {
|
|
||||||
message.sequence = 0;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseModuleAccount: object = { name: "", permissions: "" };
|
|
||||||
|
|
||||||
export const ModuleAccount = {
|
|
||||||
encode(message: ModuleAccount, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.base_account !== undefined) {
|
|
||||||
BaseAccount.encode(
|
|
||||||
message.base_account,
|
|
||||||
writer.uint32(10).fork()
|
|
||||||
).ldelim();
|
|
||||||
}
|
|
||||||
if (message.name !== "") {
|
|
||||||
writer.uint32(18).string(message.name);
|
|
||||||
}
|
|
||||||
for (const v of message.permissions) {
|
|
||||||
writer.uint32(26).string(v!);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): ModuleAccount {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseModuleAccount } as ModuleAccount;
|
|
||||||
message.permissions = [];
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.base_account = BaseAccount.decode(reader, reader.uint32());
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.name = reader.string();
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
message.permissions.push(reader.string());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): ModuleAccount {
|
|
||||||
const message = { ...baseModuleAccount } as ModuleAccount;
|
|
||||||
message.permissions = [];
|
|
||||||
if (object.base_account !== undefined && object.base_account !== null) {
|
|
||||||
message.base_account = BaseAccount.fromJSON(object.base_account);
|
|
||||||
} else {
|
|
||||||
message.base_account = undefined;
|
|
||||||
}
|
|
||||||
if (object.name !== undefined && object.name !== null) {
|
|
||||||
message.name = String(object.name);
|
|
||||||
} else {
|
|
||||||
message.name = "";
|
|
||||||
}
|
|
||||||
if (object.permissions !== undefined && object.permissions !== null) {
|
|
||||||
for (const e of object.permissions) {
|
|
||||||
message.permissions.push(String(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: ModuleAccount): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.base_account !== undefined &&
|
|
||||||
(obj.base_account = message.base_account
|
|
||||||
? BaseAccount.toJSON(message.base_account)
|
|
||||||
: undefined);
|
|
||||||
message.name !== undefined && (obj.name = message.name);
|
|
||||||
if (message.permissions) {
|
|
||||||
obj.permissions = message.permissions.map((e) => e);
|
|
||||||
} else {
|
|
||||||
obj.permissions = [];
|
|
||||||
}
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<ModuleAccount>): ModuleAccount {
|
|
||||||
const message = { ...baseModuleAccount } as ModuleAccount;
|
|
||||||
message.permissions = [];
|
|
||||||
if (object.base_account !== undefined && object.base_account !== null) {
|
|
||||||
message.base_account = BaseAccount.fromPartial(object.base_account);
|
|
||||||
} else {
|
|
||||||
message.base_account = undefined;
|
|
||||||
}
|
|
||||||
if (object.name !== undefined && object.name !== null) {
|
|
||||||
message.name = object.name;
|
|
||||||
} else {
|
|
||||||
message.name = "";
|
|
||||||
}
|
|
||||||
if (object.permissions !== undefined && object.permissions !== null) {
|
|
||||||
for (const e of object.permissions) {
|
|
||||||
message.permissions.push(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseParams: object = {
|
|
||||||
max_memo_characters: 0,
|
|
||||||
tx_sig_limit: 0,
|
|
||||||
tx_size_cost_per_byte: 0,
|
|
||||||
sig_verify_cost_ed25519: 0,
|
|
||||||
sig_verify_cost_secp256k1: 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
export const Params = {
|
|
||||||
encode(message: Params, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.max_memo_characters !== 0) {
|
|
||||||
writer.uint32(8).uint64(message.max_memo_characters);
|
|
||||||
}
|
|
||||||
if (message.tx_sig_limit !== 0) {
|
|
||||||
writer.uint32(16).uint64(message.tx_sig_limit);
|
|
||||||
}
|
|
||||||
if (message.tx_size_cost_per_byte !== 0) {
|
|
||||||
writer.uint32(24).uint64(message.tx_size_cost_per_byte);
|
|
||||||
}
|
|
||||||
if (message.sig_verify_cost_ed25519 !== 0) {
|
|
||||||
writer.uint32(32).uint64(message.sig_verify_cost_ed25519);
|
|
||||||
}
|
|
||||||
if (message.sig_verify_cost_secp256k1 !== 0) {
|
|
||||||
writer.uint32(40).uint64(message.sig_verify_cost_secp256k1);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): Params {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseParams } as Params;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.max_memo_characters = longToNumber(reader.uint64() as Long);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.tx_sig_limit = longToNumber(reader.uint64() as Long);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
message.tx_size_cost_per_byte = longToNumber(reader.uint64() as Long);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
message.sig_verify_cost_ed25519 = longToNumber(
|
|
||||||
reader.uint64() as Long
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
message.sig_verify_cost_secp256k1 = longToNumber(
|
|
||||||
reader.uint64() as Long
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): Params {
|
|
||||||
const message = { ...baseParams } as Params;
|
|
||||||
if (
|
|
||||||
object.max_memo_characters !== undefined &&
|
|
||||||
object.max_memo_characters !== null
|
|
||||||
) {
|
|
||||||
message.max_memo_characters = Number(object.max_memo_characters);
|
|
||||||
} else {
|
|
||||||
message.max_memo_characters = 0;
|
|
||||||
}
|
|
||||||
if (object.tx_sig_limit !== undefined && object.tx_sig_limit !== null) {
|
|
||||||
message.tx_sig_limit = Number(object.tx_sig_limit);
|
|
||||||
} else {
|
|
||||||
message.tx_sig_limit = 0;
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.tx_size_cost_per_byte !== undefined &&
|
|
||||||
object.tx_size_cost_per_byte !== null
|
|
||||||
) {
|
|
||||||
message.tx_size_cost_per_byte = Number(object.tx_size_cost_per_byte);
|
|
||||||
} else {
|
|
||||||
message.tx_size_cost_per_byte = 0;
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.sig_verify_cost_ed25519 !== undefined &&
|
|
||||||
object.sig_verify_cost_ed25519 !== null
|
|
||||||
) {
|
|
||||||
message.sig_verify_cost_ed25519 = Number(object.sig_verify_cost_ed25519);
|
|
||||||
} else {
|
|
||||||
message.sig_verify_cost_ed25519 = 0;
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.sig_verify_cost_secp256k1 !== undefined &&
|
|
||||||
object.sig_verify_cost_secp256k1 !== null
|
|
||||||
) {
|
|
||||||
message.sig_verify_cost_secp256k1 = Number(
|
|
||||||
object.sig_verify_cost_secp256k1
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
message.sig_verify_cost_secp256k1 = 0;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: Params): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.max_memo_characters !== undefined &&
|
|
||||||
(obj.max_memo_characters = message.max_memo_characters);
|
|
||||||
message.tx_sig_limit !== undefined &&
|
|
||||||
(obj.tx_sig_limit = message.tx_sig_limit);
|
|
||||||
message.tx_size_cost_per_byte !== undefined &&
|
|
||||||
(obj.tx_size_cost_per_byte = message.tx_size_cost_per_byte);
|
|
||||||
message.sig_verify_cost_ed25519 !== undefined &&
|
|
||||||
(obj.sig_verify_cost_ed25519 = message.sig_verify_cost_ed25519);
|
|
||||||
message.sig_verify_cost_secp256k1 !== undefined &&
|
|
||||||
(obj.sig_verify_cost_secp256k1 = message.sig_verify_cost_secp256k1);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<Params>): Params {
|
|
||||||
const message = { ...baseParams } as Params;
|
|
||||||
if (
|
|
||||||
object.max_memo_characters !== undefined &&
|
|
||||||
object.max_memo_characters !== null
|
|
||||||
) {
|
|
||||||
message.max_memo_characters = object.max_memo_characters;
|
|
||||||
} else {
|
|
||||||
message.max_memo_characters = 0;
|
|
||||||
}
|
|
||||||
if (object.tx_sig_limit !== undefined && object.tx_sig_limit !== null) {
|
|
||||||
message.tx_sig_limit = object.tx_sig_limit;
|
|
||||||
} else {
|
|
||||||
message.tx_sig_limit = 0;
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.tx_size_cost_per_byte !== undefined &&
|
|
||||||
object.tx_size_cost_per_byte !== null
|
|
||||||
) {
|
|
||||||
message.tx_size_cost_per_byte = object.tx_size_cost_per_byte;
|
|
||||||
} else {
|
|
||||||
message.tx_size_cost_per_byte = 0;
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.sig_verify_cost_ed25519 !== undefined &&
|
|
||||||
object.sig_verify_cost_ed25519 !== null
|
|
||||||
) {
|
|
||||||
message.sig_verify_cost_ed25519 = object.sig_verify_cost_ed25519;
|
|
||||||
} else {
|
|
||||||
message.sig_verify_cost_ed25519 = 0;
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.sig_verify_cost_secp256k1 !== undefined &&
|
|
||||||
object.sig_verify_cost_secp256k1 !== null
|
|
||||||
) {
|
|
||||||
message.sig_verify_cost_secp256k1 = object.sig_verify_cost_secp256k1;
|
|
||||||
} else {
|
|
||||||
message.sig_verify_cost_secp256k1 = 0;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
declare var self: any | undefined;
|
|
||||||
declare var window: any | undefined;
|
|
||||||
var globalThis: any = (() => {
|
|
||||||
if (typeof globalThis !== "undefined") return globalThis;
|
|
||||||
if (typeof self !== "undefined") return self;
|
|
||||||
if (typeof window !== "undefined") return window;
|
|
||||||
if (typeof global !== "undefined") return global;
|
|
||||||
throw "Unable to locate global object";
|
|
||||||
})();
|
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
||||||
export type DeepPartial<T> = T extends Builtin
|
|
||||||
? T
|
|
||||||
: T extends Array<infer U>
|
|
||||||
? Array<DeepPartial<U>>
|
|
||||||
: T extends ReadonlyArray<infer U>
|
|
||||||
? ReadonlyArray<DeepPartial<U>>
|
|
||||||
: T extends {}
|
|
||||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
||||||
: Partial<T>;
|
|
||||||
|
|
||||||
function longToNumber(long: Long): number {
|
|
||||||
if (long.gt(Number.MAX_SAFE_INTEGER)) {
|
|
||||||
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
|
||||||
}
|
|
||||||
return long.toNumber();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (util.Long !== Long) {
|
|
||||||
util.Long = Long as any;
|
|
||||||
configure();
|
|
||||||
}
|
|
|
@ -1,107 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import { Params } from "../../../cosmos/auth/v1beta1/auth";
|
|
||||||
import { Any } from "../../../google/protobuf/any";
|
|
||||||
import { Writer, Reader } from "protobufjs/minimal";
|
|
||||||
|
|
||||||
export const protobufPackage = "cosmos.auth.v1beta1";
|
|
||||||
|
|
||||||
/** GenesisState defines the auth module's genesis state. */
|
|
||||||
export interface GenesisState {
|
|
||||||
/** params defines all the paramaters of the module. */
|
|
||||||
params: Params | undefined;
|
|
||||||
/** accounts are the accounts present at genesis. */
|
|
||||||
accounts: Any[];
|
|
||||||
}
|
|
||||||
|
|
||||||
const baseGenesisState: object = {};
|
|
||||||
|
|
||||||
export const GenesisState = {
|
|
||||||
encode(message: GenesisState, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.params !== undefined) {
|
|
||||||
Params.encode(message.params, writer.uint32(10).fork()).ldelim();
|
|
||||||
}
|
|
||||||
for (const v of message.accounts) {
|
|
||||||
Any.encode(v!, writer.uint32(18).fork()).ldelim();
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): GenesisState {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseGenesisState } as GenesisState;
|
|
||||||
message.accounts = [];
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.params = Params.decode(reader, reader.uint32());
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.accounts.push(Any.decode(reader, reader.uint32()));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): GenesisState {
|
|
||||||
const message = { ...baseGenesisState } as GenesisState;
|
|
||||||
message.accounts = [];
|
|
||||||
if (object.params !== undefined && object.params !== null) {
|
|
||||||
message.params = Params.fromJSON(object.params);
|
|
||||||
} else {
|
|
||||||
message.params = undefined;
|
|
||||||
}
|
|
||||||
if (object.accounts !== undefined && object.accounts !== null) {
|
|
||||||
for (const e of object.accounts) {
|
|
||||||
message.accounts.push(Any.fromJSON(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: GenesisState): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.params !== undefined &&
|
|
||||||
(obj.params = message.params ? Params.toJSON(message.params) : undefined);
|
|
||||||
if (message.accounts) {
|
|
||||||
obj.accounts = message.accounts.map((e) =>
|
|
||||||
e ? Any.toJSON(e) : undefined
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
obj.accounts = [];
|
|
||||||
}
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<GenesisState>): GenesisState {
|
|
||||||
const message = { ...baseGenesisState } as GenesisState;
|
|
||||||
message.accounts = [];
|
|
||||||
if (object.params !== undefined && object.params !== null) {
|
|
||||||
message.params = Params.fromPartial(object.params);
|
|
||||||
} else {
|
|
||||||
message.params = undefined;
|
|
||||||
}
|
|
||||||
if (object.accounts !== undefined && object.accounts !== null) {
|
|
||||||
for (const e of object.accounts) {
|
|
||||||
message.accounts.push(Any.fromPartial(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
||||||
export type DeepPartial<T> = T extends Builtin
|
|
||||||
? T
|
|
||||||
: T extends Array<infer U>
|
|
||||||
? Array<DeepPartial<U>>
|
|
||||||
: T extends ReadonlyArray<infer U>
|
|
||||||
? ReadonlyArray<DeepPartial<U>>
|
|
||||||
: T extends {}
|
|
||||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
||||||
: Partial<T>;
|
|
|
@ -1,493 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import { Reader, Writer } from "protobufjs/minimal";
|
|
||||||
import {
|
|
||||||
PageRequest,
|
|
||||||
PageResponse,
|
|
||||||
} from "../../../cosmos/base/query/v1beta1/pagination";
|
|
||||||
import { Any } from "../../../google/protobuf/any";
|
|
||||||
import { Params } from "../../../cosmos/auth/v1beta1/auth";
|
|
||||||
|
|
||||||
export const protobufPackage = "cosmos.auth.v1beta1";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* QueryAccountsRequest is the request type for the Query/Accounts RPC method.
|
|
||||||
*
|
|
||||||
* Since: cosmos-sdk 0.43
|
|
||||||
*/
|
|
||||||
export interface QueryAccountsRequest {
|
|
||||||
/** pagination defines an optional pagination for the request. */
|
|
||||||
pagination: PageRequest | undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* QueryAccountsResponse is the response type for the Query/Accounts RPC method.
|
|
||||||
*
|
|
||||||
* Since: cosmos-sdk 0.43
|
|
||||||
*/
|
|
||||||
export interface QueryAccountsResponse {
|
|
||||||
/** accounts are the existing accounts */
|
|
||||||
accounts: Any[];
|
|
||||||
/** pagination defines the pagination in the response. */
|
|
||||||
pagination: PageResponse | undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** QueryAccountRequest is the request type for the Query/Account RPC method. */
|
|
||||||
export interface QueryAccountRequest {
|
|
||||||
/** address defines the address to query for. */
|
|
||||||
address: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** QueryAccountResponse is the response type for the Query/Account RPC method. */
|
|
||||||
export interface QueryAccountResponse {
|
|
||||||
/** account defines the account of the corresponding address. */
|
|
||||||
account: Any | undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** QueryParamsRequest is the request type for the Query/Params RPC method. */
|
|
||||||
export interface QueryParamsRequest {}
|
|
||||||
|
|
||||||
/** QueryParamsResponse is the response type for the Query/Params RPC method. */
|
|
||||||
export interface QueryParamsResponse {
|
|
||||||
/** params defines the parameters of the module. */
|
|
||||||
params: Params | undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
const baseQueryAccountsRequest: object = {};
|
|
||||||
|
|
||||||
export const QueryAccountsRequest = {
|
|
||||||
encode(
|
|
||||||
message: QueryAccountsRequest,
|
|
||||||
writer: Writer = Writer.create()
|
|
||||||
): Writer {
|
|
||||||
if (message.pagination !== undefined) {
|
|
||||||
PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim();
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): QueryAccountsRequest {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseQueryAccountsRequest } as QueryAccountsRequest;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.pagination = PageRequest.decode(reader, reader.uint32());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): QueryAccountsRequest {
|
|
||||||
const message = { ...baseQueryAccountsRequest } as QueryAccountsRequest;
|
|
||||||
if (object.pagination !== undefined && object.pagination !== null) {
|
|
||||||
message.pagination = PageRequest.fromJSON(object.pagination);
|
|
||||||
} else {
|
|
||||||
message.pagination = undefined;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: QueryAccountsRequest): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.pagination !== undefined &&
|
|
||||||
(obj.pagination = message.pagination
|
|
||||||
? PageRequest.toJSON(message.pagination)
|
|
||||||
: undefined);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<QueryAccountsRequest>): QueryAccountsRequest {
|
|
||||||
const message = { ...baseQueryAccountsRequest } as QueryAccountsRequest;
|
|
||||||
if (object.pagination !== undefined && object.pagination !== null) {
|
|
||||||
message.pagination = PageRequest.fromPartial(object.pagination);
|
|
||||||
} else {
|
|
||||||
message.pagination = undefined;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseQueryAccountsResponse: object = {};
|
|
||||||
|
|
||||||
export const QueryAccountsResponse = {
|
|
||||||
encode(
|
|
||||||
message: QueryAccountsResponse,
|
|
||||||
writer: Writer = Writer.create()
|
|
||||||
): Writer {
|
|
||||||
for (const v of message.accounts) {
|
|
||||||
Any.encode(v!, writer.uint32(10).fork()).ldelim();
|
|
||||||
}
|
|
||||||
if (message.pagination !== undefined) {
|
|
||||||
PageResponse.encode(
|
|
||||||
message.pagination,
|
|
||||||
writer.uint32(18).fork()
|
|
||||||
).ldelim();
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): QueryAccountsResponse {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseQueryAccountsResponse } as QueryAccountsResponse;
|
|
||||||
message.accounts = [];
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.accounts.push(Any.decode(reader, reader.uint32()));
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.pagination = PageResponse.decode(reader, reader.uint32());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): QueryAccountsResponse {
|
|
||||||
const message = { ...baseQueryAccountsResponse } as QueryAccountsResponse;
|
|
||||||
message.accounts = [];
|
|
||||||
if (object.accounts !== undefined && object.accounts !== null) {
|
|
||||||
for (const e of object.accounts) {
|
|
||||||
message.accounts.push(Any.fromJSON(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (object.pagination !== undefined && object.pagination !== null) {
|
|
||||||
message.pagination = PageResponse.fromJSON(object.pagination);
|
|
||||||
} else {
|
|
||||||
message.pagination = undefined;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: QueryAccountsResponse): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
if (message.accounts) {
|
|
||||||
obj.accounts = message.accounts.map((e) =>
|
|
||||||
e ? Any.toJSON(e) : undefined
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
obj.accounts = [];
|
|
||||||
}
|
|
||||||
message.pagination !== undefined &&
|
|
||||||
(obj.pagination = message.pagination
|
|
||||||
? PageResponse.toJSON(message.pagination)
|
|
||||||
: undefined);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(
|
|
||||||
object: DeepPartial<QueryAccountsResponse>
|
|
||||||
): QueryAccountsResponse {
|
|
||||||
const message = { ...baseQueryAccountsResponse } as QueryAccountsResponse;
|
|
||||||
message.accounts = [];
|
|
||||||
if (object.accounts !== undefined && object.accounts !== null) {
|
|
||||||
for (const e of object.accounts) {
|
|
||||||
message.accounts.push(Any.fromPartial(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (object.pagination !== undefined && object.pagination !== null) {
|
|
||||||
message.pagination = PageResponse.fromPartial(object.pagination);
|
|
||||||
} else {
|
|
||||||
message.pagination = undefined;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseQueryAccountRequest: object = { address: "" };
|
|
||||||
|
|
||||||
export const QueryAccountRequest = {
|
|
||||||
encode(
|
|
||||||
message: QueryAccountRequest,
|
|
||||||
writer: Writer = Writer.create()
|
|
||||||
): Writer {
|
|
||||||
if (message.address !== "") {
|
|
||||||
writer.uint32(10).string(message.address);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): QueryAccountRequest {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseQueryAccountRequest } as QueryAccountRequest;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.address = reader.string();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): QueryAccountRequest {
|
|
||||||
const message = { ...baseQueryAccountRequest } as QueryAccountRequest;
|
|
||||||
if (object.address !== undefined && object.address !== null) {
|
|
||||||
message.address = String(object.address);
|
|
||||||
} else {
|
|
||||||
message.address = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: QueryAccountRequest): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.address !== undefined && (obj.address = message.address);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<QueryAccountRequest>): QueryAccountRequest {
|
|
||||||
const message = { ...baseQueryAccountRequest } as QueryAccountRequest;
|
|
||||||
if (object.address !== undefined && object.address !== null) {
|
|
||||||
message.address = object.address;
|
|
||||||
} else {
|
|
||||||
message.address = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseQueryAccountResponse: object = {};
|
|
||||||
|
|
||||||
export const QueryAccountResponse = {
|
|
||||||
encode(
|
|
||||||
message: QueryAccountResponse,
|
|
||||||
writer: Writer = Writer.create()
|
|
||||||
): Writer {
|
|
||||||
if (message.account !== undefined) {
|
|
||||||
Any.encode(message.account, writer.uint32(10).fork()).ldelim();
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): QueryAccountResponse {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseQueryAccountResponse } as QueryAccountResponse;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.account = Any.decode(reader, reader.uint32());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): QueryAccountResponse {
|
|
||||||
const message = { ...baseQueryAccountResponse } as QueryAccountResponse;
|
|
||||||
if (object.account !== undefined && object.account !== null) {
|
|
||||||
message.account = Any.fromJSON(object.account);
|
|
||||||
} else {
|
|
||||||
message.account = undefined;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: QueryAccountResponse): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.account !== undefined &&
|
|
||||||
(obj.account = message.account ? Any.toJSON(message.account) : undefined);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<QueryAccountResponse>): QueryAccountResponse {
|
|
||||||
const message = { ...baseQueryAccountResponse } as QueryAccountResponse;
|
|
||||||
if (object.account !== undefined && object.account !== null) {
|
|
||||||
message.account = Any.fromPartial(object.account);
|
|
||||||
} else {
|
|
||||||
message.account = undefined;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseQueryParamsRequest: object = {};
|
|
||||||
|
|
||||||
export const QueryParamsRequest = {
|
|
||||||
encode(_: QueryParamsRequest, writer: Writer = Writer.create()): Writer {
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): QueryParamsRequest {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseQueryParamsRequest } as QueryParamsRequest;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(_: any): QueryParamsRequest {
|
|
||||||
const message = { ...baseQueryParamsRequest } as QueryParamsRequest;
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(_: QueryParamsRequest): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(_: DeepPartial<QueryParamsRequest>): QueryParamsRequest {
|
|
||||||
const message = { ...baseQueryParamsRequest } as QueryParamsRequest;
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseQueryParamsResponse: object = {};
|
|
||||||
|
|
||||||
export const QueryParamsResponse = {
|
|
||||||
encode(
|
|
||||||
message: QueryParamsResponse,
|
|
||||||
writer: Writer = Writer.create()
|
|
||||||
): Writer {
|
|
||||||
if (message.params !== undefined) {
|
|
||||||
Params.encode(message.params, writer.uint32(10).fork()).ldelim();
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): QueryParamsResponse {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseQueryParamsResponse } as QueryParamsResponse;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.params = Params.decode(reader, reader.uint32());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): QueryParamsResponse {
|
|
||||||
const message = { ...baseQueryParamsResponse } as QueryParamsResponse;
|
|
||||||
if (object.params !== undefined && object.params !== null) {
|
|
||||||
message.params = Params.fromJSON(object.params);
|
|
||||||
} else {
|
|
||||||
message.params = undefined;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: QueryParamsResponse): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.params !== undefined &&
|
|
||||||
(obj.params = message.params ? Params.toJSON(message.params) : undefined);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<QueryParamsResponse>): QueryParamsResponse {
|
|
||||||
const message = { ...baseQueryParamsResponse } as QueryParamsResponse;
|
|
||||||
if (object.params !== undefined && object.params !== null) {
|
|
||||||
message.params = Params.fromPartial(object.params);
|
|
||||||
} else {
|
|
||||||
message.params = undefined;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
/** Query defines the gRPC querier service. */
|
|
||||||
export interface Query {
|
|
||||||
/**
|
|
||||||
* Accounts returns all the existing accounts
|
|
||||||
*
|
|
||||||
* Since: cosmos-sdk 0.43
|
|
||||||
*/
|
|
||||||
Accounts(request: QueryAccountsRequest): Promise<QueryAccountsResponse>;
|
|
||||||
/** Account returns account details based on address. */
|
|
||||||
Account(request: QueryAccountRequest): Promise<QueryAccountResponse>;
|
|
||||||
/** Params queries all parameters. */
|
|
||||||
Params(request: QueryParamsRequest): Promise<QueryParamsResponse>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class QueryClientImpl implements Query {
|
|
||||||
private readonly rpc: Rpc;
|
|
||||||
constructor(rpc: Rpc) {
|
|
||||||
this.rpc = rpc;
|
|
||||||
}
|
|
||||||
Accounts(request: QueryAccountsRequest): Promise<QueryAccountsResponse> {
|
|
||||||
const data = QueryAccountsRequest.encode(request).finish();
|
|
||||||
const promise = this.rpc.request(
|
|
||||||
"cosmos.auth.v1beta1.Query",
|
|
||||||
"Accounts",
|
|
||||||
data
|
|
||||||
);
|
|
||||||
return promise.then((data) =>
|
|
||||||
QueryAccountsResponse.decode(new Reader(data))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Account(request: QueryAccountRequest): Promise<QueryAccountResponse> {
|
|
||||||
const data = QueryAccountRequest.encode(request).finish();
|
|
||||||
const promise = this.rpc.request(
|
|
||||||
"cosmos.auth.v1beta1.Query",
|
|
||||||
"Account",
|
|
||||||
data
|
|
||||||
);
|
|
||||||
return promise.then((data) =>
|
|
||||||
QueryAccountResponse.decode(new Reader(data))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Params(request: QueryParamsRequest): Promise<QueryParamsResponse> {
|
|
||||||
const data = QueryParamsRequest.encode(request).finish();
|
|
||||||
const promise = this.rpc.request(
|
|
||||||
"cosmos.auth.v1beta1.Query",
|
|
||||||
"Params",
|
|
||||||
data
|
|
||||||
);
|
|
||||||
return promise.then((data) => QueryParamsResponse.decode(new Reader(data)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Rpc {
|
|
||||||
request(
|
|
||||||
service: string,
|
|
||||||
method: string,
|
|
||||||
data: Uint8Array
|
|
||||||
): Promise<Uint8Array>;
|
|
||||||
}
|
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
||||||
export type DeepPartial<T> = T extends Builtin
|
|
||||||
? T
|
|
||||||
: T extends Array<infer U>
|
|
||||||
? Array<DeepPartial<U>>
|
|
||||||
: T extends ReadonlyArray<infer U>
|
|
||||||
? ReadonlyArray<DeepPartial<U>>
|
|
||||||
: T extends {}
|
|
||||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
||||||
: Partial<T>;
|
|
|
@ -1,328 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import * as Long from "long";
|
|
||||||
import { util, configure, Writer, Reader } from "protobufjs/minimal";
|
|
||||||
|
|
||||||
export const protobufPackage = "cosmos.base.query.v1beta1";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PageRequest is to be embedded in gRPC request messages for efficient
|
|
||||||
* pagination. Ex:
|
|
||||||
*
|
|
||||||
* message SomeRequest {
|
|
||||||
* Foo some_parameter = 1;
|
|
||||||
* PageRequest pagination = 2;
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
export interface PageRequest {
|
|
||||||
/**
|
|
||||||
* key is a value returned in PageResponse.next_key to begin
|
|
||||||
* querying the next page most efficiently. Only one of offset or key
|
|
||||||
* should be set.
|
|
||||||
*/
|
|
||||||
key: Uint8Array;
|
|
||||||
/**
|
|
||||||
* offset is a numeric offset that can be used when key is unavailable.
|
|
||||||
* It is less efficient than using key. Only one of offset or key should
|
|
||||||
* be set.
|
|
||||||
*/
|
|
||||||
offset: number;
|
|
||||||
/**
|
|
||||||
* limit is the total number of results to be returned in the result page.
|
|
||||||
* If left empty it will default to a value to be set by each app.
|
|
||||||
*/
|
|
||||||
limit: number;
|
|
||||||
/**
|
|
||||||
* count_total is set to true to indicate that the result set should include
|
|
||||||
* a count of the total number of items available for pagination in UIs.
|
|
||||||
* count_total is only respected when offset is used. It is ignored when key
|
|
||||||
* is set.
|
|
||||||
*/
|
|
||||||
count_total: boolean;
|
|
||||||
/**
|
|
||||||
* reverse is set to true if results are to be returned in the descending order.
|
|
||||||
*
|
|
||||||
* Since: cosmos-sdk 0.43
|
|
||||||
*/
|
|
||||||
reverse: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PageResponse is to be embedded in gRPC response messages where the
|
|
||||||
* corresponding request message has used PageRequest.
|
|
||||||
*
|
|
||||||
* message SomeResponse {
|
|
||||||
* repeated Bar results = 1;
|
|
||||||
* PageResponse page = 2;
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
export interface PageResponse {
|
|
||||||
/**
|
|
||||||
* next_key is the key to be passed to PageRequest.key to
|
|
||||||
* query the next page most efficiently
|
|
||||||
*/
|
|
||||||
next_key: Uint8Array;
|
|
||||||
/**
|
|
||||||
* total is total number of results available if PageRequest.count_total
|
|
||||||
* was set, its value is undefined otherwise
|
|
||||||
*/
|
|
||||||
total: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
const basePageRequest: object = {
|
|
||||||
offset: 0,
|
|
||||||
limit: 0,
|
|
||||||
count_total: false,
|
|
||||||
reverse: false,
|
|
||||||
};
|
|
||||||
|
|
||||||
export const PageRequest = {
|
|
||||||
encode(message: PageRequest, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.key.length !== 0) {
|
|
||||||
writer.uint32(10).bytes(message.key);
|
|
||||||
}
|
|
||||||
if (message.offset !== 0) {
|
|
||||||
writer.uint32(16).uint64(message.offset);
|
|
||||||
}
|
|
||||||
if (message.limit !== 0) {
|
|
||||||
writer.uint32(24).uint64(message.limit);
|
|
||||||
}
|
|
||||||
if (message.count_total === true) {
|
|
||||||
writer.uint32(32).bool(message.count_total);
|
|
||||||
}
|
|
||||||
if (message.reverse === true) {
|
|
||||||
writer.uint32(40).bool(message.reverse);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): PageRequest {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...basePageRequest } as PageRequest;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.key = reader.bytes();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.offset = longToNumber(reader.uint64() as Long);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
message.limit = longToNumber(reader.uint64() as Long);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
message.count_total = reader.bool();
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
message.reverse = reader.bool();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): PageRequest {
|
|
||||||
const message = { ...basePageRequest } as PageRequest;
|
|
||||||
if (object.key !== undefined && object.key !== null) {
|
|
||||||
message.key = bytesFromBase64(object.key);
|
|
||||||
}
|
|
||||||
if (object.offset !== undefined && object.offset !== null) {
|
|
||||||
message.offset = Number(object.offset);
|
|
||||||
} else {
|
|
||||||
message.offset = 0;
|
|
||||||
}
|
|
||||||
if (object.limit !== undefined && object.limit !== null) {
|
|
||||||
message.limit = Number(object.limit);
|
|
||||||
} else {
|
|
||||||
message.limit = 0;
|
|
||||||
}
|
|
||||||
if (object.count_total !== undefined && object.count_total !== null) {
|
|
||||||
message.count_total = Boolean(object.count_total);
|
|
||||||
} else {
|
|
||||||
message.count_total = false;
|
|
||||||
}
|
|
||||||
if (object.reverse !== undefined && object.reverse !== null) {
|
|
||||||
message.reverse = Boolean(object.reverse);
|
|
||||||
} else {
|
|
||||||
message.reverse = false;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: PageRequest): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.key !== undefined &&
|
|
||||||
(obj.key = base64FromBytes(
|
|
||||||
message.key !== undefined ? message.key : new Uint8Array()
|
|
||||||
));
|
|
||||||
message.offset !== undefined && (obj.offset = message.offset);
|
|
||||||
message.limit !== undefined && (obj.limit = message.limit);
|
|
||||||
message.count_total !== undefined &&
|
|
||||||
(obj.count_total = message.count_total);
|
|
||||||
message.reverse !== undefined && (obj.reverse = message.reverse);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<PageRequest>): PageRequest {
|
|
||||||
const message = { ...basePageRequest } as PageRequest;
|
|
||||||
if (object.key !== undefined && object.key !== null) {
|
|
||||||
message.key = object.key;
|
|
||||||
} else {
|
|
||||||
message.key = new Uint8Array();
|
|
||||||
}
|
|
||||||
if (object.offset !== undefined && object.offset !== null) {
|
|
||||||
message.offset = object.offset;
|
|
||||||
} else {
|
|
||||||
message.offset = 0;
|
|
||||||
}
|
|
||||||
if (object.limit !== undefined && object.limit !== null) {
|
|
||||||
message.limit = object.limit;
|
|
||||||
} else {
|
|
||||||
message.limit = 0;
|
|
||||||
}
|
|
||||||
if (object.count_total !== undefined && object.count_total !== null) {
|
|
||||||
message.count_total = object.count_total;
|
|
||||||
} else {
|
|
||||||
message.count_total = false;
|
|
||||||
}
|
|
||||||
if (object.reverse !== undefined && object.reverse !== null) {
|
|
||||||
message.reverse = object.reverse;
|
|
||||||
} else {
|
|
||||||
message.reverse = false;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const basePageResponse: object = { total: 0 };
|
|
||||||
|
|
||||||
export const PageResponse = {
|
|
||||||
encode(message: PageResponse, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.next_key.length !== 0) {
|
|
||||||
writer.uint32(10).bytes(message.next_key);
|
|
||||||
}
|
|
||||||
if (message.total !== 0) {
|
|
||||||
writer.uint32(16).uint64(message.total);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): PageResponse {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...basePageResponse } as PageResponse;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.next_key = reader.bytes();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.total = longToNumber(reader.uint64() as Long);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): PageResponse {
|
|
||||||
const message = { ...basePageResponse } as PageResponse;
|
|
||||||
if (object.next_key !== undefined && object.next_key !== null) {
|
|
||||||
message.next_key = bytesFromBase64(object.next_key);
|
|
||||||
}
|
|
||||||
if (object.total !== undefined && object.total !== null) {
|
|
||||||
message.total = Number(object.total);
|
|
||||||
} else {
|
|
||||||
message.total = 0;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: PageResponse): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.next_key !== undefined &&
|
|
||||||
(obj.next_key = base64FromBytes(
|
|
||||||
message.next_key !== undefined ? message.next_key : new Uint8Array()
|
|
||||||
));
|
|
||||||
message.total !== undefined && (obj.total = message.total);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<PageResponse>): PageResponse {
|
|
||||||
const message = { ...basePageResponse } as PageResponse;
|
|
||||||
if (object.next_key !== undefined && object.next_key !== null) {
|
|
||||||
message.next_key = object.next_key;
|
|
||||||
} else {
|
|
||||||
message.next_key = new Uint8Array();
|
|
||||||
}
|
|
||||||
if (object.total !== undefined && object.total !== null) {
|
|
||||||
message.total = object.total;
|
|
||||||
} else {
|
|
||||||
message.total = 0;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
declare var self: any | undefined;
|
|
||||||
declare var window: any | undefined;
|
|
||||||
var globalThis: any = (() => {
|
|
||||||
if (typeof globalThis !== "undefined") return globalThis;
|
|
||||||
if (typeof self !== "undefined") return self;
|
|
||||||
if (typeof window !== "undefined") return window;
|
|
||||||
if (typeof global !== "undefined") return global;
|
|
||||||
throw "Unable to locate global object";
|
|
||||||
})();
|
|
||||||
|
|
||||||
const atob: (b64: string) => string =
|
|
||||||
globalThis.atob ||
|
|
||||||
((b64) => globalThis.Buffer.from(b64, "base64").toString("binary"));
|
|
||||||
function bytesFromBase64(b64: string): Uint8Array {
|
|
||||||
const bin = atob(b64);
|
|
||||||
const arr = new Uint8Array(bin.length);
|
|
||||||
for (let i = 0; i < bin.length; ++i) {
|
|
||||||
arr[i] = bin.charCodeAt(i);
|
|
||||||
}
|
|
||||||
return arr;
|
|
||||||
}
|
|
||||||
|
|
||||||
const btoa: (bin: string) => string =
|
|
||||||
globalThis.btoa ||
|
|
||||||
((bin) => globalThis.Buffer.from(bin, "binary").toString("base64"));
|
|
||||||
function base64FromBytes(arr: Uint8Array): string {
|
|
||||||
const bin: string[] = [];
|
|
||||||
for (let i = 0; i < arr.byteLength; ++i) {
|
|
||||||
bin.push(String.fromCharCode(arr[i]));
|
|
||||||
}
|
|
||||||
return btoa(bin.join(""));
|
|
||||||
}
|
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
||||||
export type DeepPartial<T> = T extends Builtin
|
|
||||||
? T
|
|
||||||
: T extends Array<infer U>
|
|
||||||
? Array<DeepPartial<U>>
|
|
||||||
: T extends ReadonlyArray<infer U>
|
|
||||||
? ReadonlyArray<DeepPartial<U>>
|
|
||||||
: T extends {}
|
|
||||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
||||||
: Partial<T>;
|
|
||||||
|
|
||||||
function longToNumber(long: Long): number {
|
|
||||||
if (long.gt(Number.MAX_SAFE_INTEGER)) {
|
|
||||||
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
|
||||||
}
|
|
||||||
return long.toNumber();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (util.Long !== Long) {
|
|
||||||
util.Long = Long as any;
|
|
||||||
configure();
|
|
||||||
}
|
|
|
@ -1,2 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
export const protobufPackage = "cosmos_proto";
|
|
|
@ -1,2 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
export const protobufPackage = "gogoproto";
|
|
|
@ -1,2 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
export const protobufPackage = "google.api";
|
|
|
@ -1,706 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import { Writer, Reader } from "protobufjs/minimal";
|
|
||||||
|
|
||||||
export const protobufPackage = "google.api";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Defines the HTTP configuration for an API service. It contains a list of
|
|
||||||
* [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method
|
|
||||||
* to one or more HTTP REST API methods.
|
|
||||||
*/
|
|
||||||
export interface Http {
|
|
||||||
/**
|
|
||||||
* A list of HTTP configuration rules that apply to individual API methods.
|
|
||||||
*
|
|
||||||
* **NOTE:** All service configuration rules follow "last one wins" order.
|
|
||||||
*/
|
|
||||||
rules: HttpRule[];
|
|
||||||
/**
|
|
||||||
* When set to true, URL path parmeters will be fully URI-decoded except in
|
|
||||||
* cases of single segment matches in reserved expansion, where "%2F" will be
|
|
||||||
* left encoded.
|
|
||||||
*
|
|
||||||
* The default behavior is to not decode RFC 6570 reserved characters in multi
|
|
||||||
* segment matches.
|
|
||||||
*/
|
|
||||||
fully_decode_reserved_expansion: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* `HttpRule` defines the mapping of an RPC method to one or more HTTP
|
|
||||||
* REST API methods. The mapping specifies how different portions of the RPC
|
|
||||||
* request message are mapped to URL path, URL query parameters, and
|
|
||||||
* HTTP request body. The mapping is typically specified as an
|
|
||||||
* `google.api.http` annotation on the RPC method,
|
|
||||||
* see "google/api/annotations.proto" for details.
|
|
||||||
*
|
|
||||||
* The mapping consists of a field specifying the path template and
|
|
||||||
* method kind. The path template can refer to fields in the request
|
|
||||||
* message, as in the example below which describes a REST GET
|
|
||||||
* operation on a resource collection of messages:
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* service Messaging {
|
|
||||||
* rpc GetMessage(GetMessageRequest) returns (Message) {
|
|
||||||
* option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}";
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* message GetMessageRequest {
|
|
||||||
* message SubMessage {
|
|
||||||
* string subfield = 1;
|
|
||||||
* }
|
|
||||||
* string message_id = 1; // mapped to the URL
|
|
||||||
* SubMessage sub = 2; // `sub.subfield` is url-mapped
|
|
||||||
* }
|
|
||||||
* message Message {
|
|
||||||
* string text = 1; // content of the resource
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* The same http annotation can alternatively be expressed inside the
|
|
||||||
* `GRPC API Configuration` YAML file.
|
|
||||||
*
|
|
||||||
* http:
|
|
||||||
* rules:
|
|
||||||
* - selector: <proto_package_name>.Messaging.GetMessage
|
|
||||||
* get: /v1/messages/{message_id}/{sub.subfield}
|
|
||||||
*
|
|
||||||
* This definition enables an automatic, bidrectional mapping of HTTP
|
|
||||||
* JSON to RPC. Example:
|
|
||||||
*
|
|
||||||
* HTTP | RPC
|
|
||||||
* -----|-----
|
|
||||||
* `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))`
|
|
||||||
*
|
|
||||||
* In general, not only fields but also field paths can be referenced
|
|
||||||
* from a path pattern. Fields mapped to the path pattern cannot be
|
|
||||||
* repeated and must have a primitive (non-message) type.
|
|
||||||
*
|
|
||||||
* Any fields in the request message which are not bound by the path
|
|
||||||
* pattern automatically become (optional) HTTP query
|
|
||||||
* parameters. Assume the following definition of the request message:
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* service Messaging {
|
|
||||||
* rpc GetMessage(GetMessageRequest) returns (Message) {
|
|
||||||
* option (google.api.http).get = "/v1/messages/{message_id}";
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* message GetMessageRequest {
|
|
||||||
* message SubMessage {
|
|
||||||
* string subfield = 1;
|
|
||||||
* }
|
|
||||||
* string message_id = 1; // mapped to the URL
|
|
||||||
* int64 revision = 2; // becomes a parameter
|
|
||||||
* SubMessage sub = 3; // `sub.subfield` becomes a parameter
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* This enables a HTTP JSON to RPC mapping as below:
|
|
||||||
*
|
|
||||||
* HTTP | RPC
|
|
||||||
* -----|-----
|
|
||||||
* `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))`
|
|
||||||
*
|
|
||||||
* Note that fields which are mapped to HTTP parameters must have a
|
|
||||||
* primitive type or a repeated primitive type. Message types are not
|
|
||||||
* allowed. In the case of a repeated type, the parameter can be
|
|
||||||
* repeated in the URL, as in `...?param=A¶m=B`.
|
|
||||||
*
|
|
||||||
* For HTTP method kinds which allow a request body, the `body` field
|
|
||||||
* specifies the mapping. Consider a REST update method on the
|
|
||||||
* message resource collection:
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* service Messaging {
|
|
||||||
* rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
|
|
||||||
* option (google.api.http) = {
|
|
||||||
* put: "/v1/messages/{message_id}"
|
|
||||||
* body: "message"
|
|
||||||
* };
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* message UpdateMessageRequest {
|
|
||||||
* string message_id = 1; // mapped to the URL
|
|
||||||
* Message message = 2; // mapped to the body
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* The following HTTP JSON to RPC mapping is enabled, where the
|
|
||||||
* representation of the JSON in the request body is determined by
|
|
||||||
* protos JSON encoding:
|
|
||||||
*
|
|
||||||
* HTTP | RPC
|
|
||||||
* -----|-----
|
|
||||||
* `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })`
|
|
||||||
*
|
|
||||||
* The special name `*` can be used in the body mapping to define that
|
|
||||||
* every field not bound by the path template should be mapped to the
|
|
||||||
* request body. This enables the following alternative definition of
|
|
||||||
* the update method:
|
|
||||||
*
|
|
||||||
* service Messaging {
|
|
||||||
* rpc UpdateMessage(Message) returns (Message) {
|
|
||||||
* option (google.api.http) = {
|
|
||||||
* put: "/v1/messages/{message_id}"
|
|
||||||
* body: "*"
|
|
||||||
* };
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* message Message {
|
|
||||||
* string message_id = 1;
|
|
||||||
* string text = 2;
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* The following HTTP JSON to RPC mapping is enabled:
|
|
||||||
*
|
|
||||||
* HTTP | RPC
|
|
||||||
* -----|-----
|
|
||||||
* `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")`
|
|
||||||
*
|
|
||||||
* Note that when using `*` in the body mapping, it is not possible to
|
|
||||||
* have HTTP parameters, as all fields not bound by the path end in
|
|
||||||
* the body. This makes this option more rarely used in practice of
|
|
||||||
* defining REST APIs. The common usage of `*` is in custom methods
|
|
||||||
* which don't use the URL at all for transferring data.
|
|
||||||
*
|
|
||||||
* It is possible to define multiple HTTP methods for one RPC by using
|
|
||||||
* the `additional_bindings` option. Example:
|
|
||||||
*
|
|
||||||
* service Messaging {
|
|
||||||
* rpc GetMessage(GetMessageRequest) returns (Message) {
|
|
||||||
* option (google.api.http) = {
|
|
||||||
* get: "/v1/messages/{message_id}"
|
|
||||||
* additional_bindings {
|
|
||||||
* get: "/v1/users/{user_id}/messages/{message_id}"
|
|
||||||
* }
|
|
||||||
* };
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* message GetMessageRequest {
|
|
||||||
* string message_id = 1;
|
|
||||||
* string user_id = 2;
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* This enables the following two alternative HTTP JSON to RPC
|
|
||||||
* mappings:
|
|
||||||
*
|
|
||||||
* HTTP | RPC
|
|
||||||
* -----|-----
|
|
||||||
* `GET /v1/messages/123456` | `GetMessage(message_id: "123456")`
|
|
||||||
* `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")`
|
|
||||||
*
|
|
||||||
* # Rules for HTTP mapping
|
|
||||||
*
|
|
||||||
* The rules for mapping HTTP path, query parameters, and body fields
|
|
||||||
* to the request message are as follows:
|
|
||||||
*
|
|
||||||
* 1. The `body` field specifies either `*` or a field path, or is
|
|
||||||
* omitted. If omitted, it indicates there is no HTTP request body.
|
|
||||||
* 2. Leaf fields (recursive expansion of nested messages in the
|
|
||||||
* request) can be classified into three types:
|
|
||||||
* (a) Matched in the URL template.
|
|
||||||
* (b) Covered by body (if body is `*`, everything except (a) fields;
|
|
||||||
* else everything under the body field)
|
|
||||||
* (c) All other fields.
|
|
||||||
* 3. URL query parameters found in the HTTP request are mapped to (c) fields.
|
|
||||||
* 4. Any body sent with an HTTP request can contain only (b) fields.
|
|
||||||
*
|
|
||||||
* The syntax of the path template is as follows:
|
|
||||||
*
|
|
||||||
* Template = "/" Segments [ Verb ] ;
|
|
||||||
* Segments = Segment { "/" Segment } ;
|
|
||||||
* Segment = "*" | "**" | LITERAL | Variable ;
|
|
||||||
* Variable = "{" FieldPath [ "=" Segments ] "}" ;
|
|
||||||
* FieldPath = IDENT { "." IDENT } ;
|
|
||||||
* Verb = ":" LITERAL ;
|
|
||||||
*
|
|
||||||
* The syntax `*` matches a single path segment. The syntax `**` matches zero
|
|
||||||
* or more path segments, which must be the last part of the path except the
|
|
||||||
* `Verb`. The syntax `LITERAL` matches literal text in the path.
|
|
||||||
*
|
|
||||||
* The syntax `Variable` matches part of the URL path as specified by its
|
|
||||||
* template. A variable template must not contain other variables. If a variable
|
|
||||||
* matches a single path segment, its template may be omitted, e.g. `{var}`
|
|
||||||
* is equivalent to `{var=*}`.
|
|
||||||
*
|
|
||||||
* If a variable contains exactly one path segment, such as `"{var}"` or
|
|
||||||
* `"{var=*}"`, when such a variable is expanded into a URL path, all characters
|
|
||||||
* except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the
|
|
||||||
* Discovery Document as `{var}`.
|
|
||||||
*
|
|
||||||
* If a variable contains one or more path segments, such as `"{var=foo/*}"`
|
|
||||||
* or `"{var=**}"`, when such a variable is expanded into a URL path, all
|
|
||||||
* characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables
|
|
||||||
* show up in the Discovery Document as `{+var}`.
|
|
||||||
*
|
|
||||||
* NOTE: While the single segment variable matches the semantics of
|
|
||||||
* [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2
|
|
||||||
* Simple String Expansion, the multi segment variable **does not** match
|
|
||||||
* RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion
|
|
||||||
* does not expand special characters like `?` and `#`, which would lead
|
|
||||||
* to invalid URLs.
|
|
||||||
*
|
|
||||||
* NOTE: the field paths in variables and in the `body` must not refer to
|
|
||||||
* repeated fields or map fields.
|
|
||||||
*/
|
|
||||||
export interface HttpRule {
|
|
||||||
/**
|
|
||||||
* Selects methods to which this rule applies.
|
|
||||||
*
|
|
||||||
* Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
|
|
||||||
*/
|
|
||||||
selector: string;
|
|
||||||
/** Used for listing and getting information about resources. */
|
|
||||||
get: string | undefined;
|
|
||||||
/** Used for updating a resource. */
|
|
||||||
put: string | undefined;
|
|
||||||
/** Used for creating a resource. */
|
|
||||||
post: string | undefined;
|
|
||||||
/** Used for deleting a resource. */
|
|
||||||
delete: string | undefined;
|
|
||||||
/** Used for updating a resource. */
|
|
||||||
patch: string | undefined;
|
|
||||||
/**
|
|
||||||
* The custom pattern is used for specifying an HTTP method that is not
|
|
||||||
* included in the `pattern` field, such as HEAD, or "*" to leave the
|
|
||||||
* HTTP method unspecified for this rule. The wild-card rule is useful
|
|
||||||
* for services that provide content to Web (HTML) clients.
|
|
||||||
*/
|
|
||||||
custom: CustomHttpPattern | undefined;
|
|
||||||
/**
|
|
||||||
* The name of the request field whose value is mapped to the HTTP body, or
|
|
||||||
* `*` for mapping all fields not captured by the path pattern to the HTTP
|
|
||||||
* body. NOTE: the referred field must not be a repeated field and must be
|
|
||||||
* present at the top-level of request message type.
|
|
||||||
*/
|
|
||||||
body: string;
|
|
||||||
/**
|
|
||||||
* Optional. The name of the response field whose value is mapped to the HTTP
|
|
||||||
* body of response. Other response fields are ignored. When
|
|
||||||
* not set, the response message will be used as HTTP body of response.
|
|
||||||
*/
|
|
||||||
response_body: string;
|
|
||||||
/**
|
|
||||||
* Additional HTTP bindings for the selector. Nested bindings must
|
|
||||||
* not contain an `additional_bindings` field themselves (that is,
|
|
||||||
* the nesting may only be one level deep).
|
|
||||||
*/
|
|
||||||
additional_bindings: HttpRule[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** A custom pattern is used for defining custom HTTP verb. */
|
|
||||||
export interface CustomHttpPattern {
|
|
||||||
/** The name of this custom HTTP verb. */
|
|
||||||
kind: string;
|
|
||||||
/** The path matched by this custom verb. */
|
|
||||||
path: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
const baseHttp: object = { fully_decode_reserved_expansion: false };
|
|
||||||
|
|
||||||
export const Http = {
|
|
||||||
encode(message: Http, writer: Writer = Writer.create()): Writer {
|
|
||||||
for (const v of message.rules) {
|
|
||||||
HttpRule.encode(v!, writer.uint32(10).fork()).ldelim();
|
|
||||||
}
|
|
||||||
if (message.fully_decode_reserved_expansion === true) {
|
|
||||||
writer.uint32(16).bool(message.fully_decode_reserved_expansion);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): Http {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseHttp } as Http;
|
|
||||||
message.rules = [];
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.rules.push(HttpRule.decode(reader, reader.uint32()));
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.fully_decode_reserved_expansion = reader.bool();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): Http {
|
|
||||||
const message = { ...baseHttp } as Http;
|
|
||||||
message.rules = [];
|
|
||||||
if (object.rules !== undefined && object.rules !== null) {
|
|
||||||
for (const e of object.rules) {
|
|
||||||
message.rules.push(HttpRule.fromJSON(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.fully_decode_reserved_expansion !== undefined &&
|
|
||||||
object.fully_decode_reserved_expansion !== null
|
|
||||||
) {
|
|
||||||
message.fully_decode_reserved_expansion = Boolean(
|
|
||||||
object.fully_decode_reserved_expansion
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
message.fully_decode_reserved_expansion = false;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: Http): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
if (message.rules) {
|
|
||||||
obj.rules = message.rules.map((e) =>
|
|
||||||
e ? HttpRule.toJSON(e) : undefined
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
obj.rules = [];
|
|
||||||
}
|
|
||||||
message.fully_decode_reserved_expansion !== undefined &&
|
|
||||||
(obj.fully_decode_reserved_expansion =
|
|
||||||
message.fully_decode_reserved_expansion);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<Http>): Http {
|
|
||||||
const message = { ...baseHttp } as Http;
|
|
||||||
message.rules = [];
|
|
||||||
if (object.rules !== undefined && object.rules !== null) {
|
|
||||||
for (const e of object.rules) {
|
|
||||||
message.rules.push(HttpRule.fromPartial(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.fully_decode_reserved_expansion !== undefined &&
|
|
||||||
object.fully_decode_reserved_expansion !== null
|
|
||||||
) {
|
|
||||||
message.fully_decode_reserved_expansion =
|
|
||||||
object.fully_decode_reserved_expansion;
|
|
||||||
} else {
|
|
||||||
message.fully_decode_reserved_expansion = false;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseHttpRule: object = { selector: "", body: "", response_body: "" };
|
|
||||||
|
|
||||||
export const HttpRule = {
|
|
||||||
encode(message: HttpRule, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.selector !== "") {
|
|
||||||
writer.uint32(10).string(message.selector);
|
|
||||||
}
|
|
||||||
if (message.get !== undefined) {
|
|
||||||
writer.uint32(18).string(message.get);
|
|
||||||
}
|
|
||||||
if (message.put !== undefined) {
|
|
||||||
writer.uint32(26).string(message.put);
|
|
||||||
}
|
|
||||||
if (message.post !== undefined) {
|
|
||||||
writer.uint32(34).string(message.post);
|
|
||||||
}
|
|
||||||
if (message.delete !== undefined) {
|
|
||||||
writer.uint32(42).string(message.delete);
|
|
||||||
}
|
|
||||||
if (message.patch !== undefined) {
|
|
||||||
writer.uint32(50).string(message.patch);
|
|
||||||
}
|
|
||||||
if (message.custom !== undefined) {
|
|
||||||
CustomHttpPattern.encode(
|
|
||||||
message.custom,
|
|
||||||
writer.uint32(66).fork()
|
|
||||||
).ldelim();
|
|
||||||
}
|
|
||||||
if (message.body !== "") {
|
|
||||||
writer.uint32(58).string(message.body);
|
|
||||||
}
|
|
||||||
if (message.response_body !== "") {
|
|
||||||
writer.uint32(98).string(message.response_body);
|
|
||||||
}
|
|
||||||
for (const v of message.additional_bindings) {
|
|
||||||
HttpRule.encode(v!, writer.uint32(90).fork()).ldelim();
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): HttpRule {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseHttpRule } as HttpRule;
|
|
||||||
message.additional_bindings = [];
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.selector = reader.string();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.get = reader.string();
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
message.put = reader.string();
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
message.post = reader.string();
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
message.delete = reader.string();
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
message.patch = reader.string();
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
message.custom = CustomHttpPattern.decode(reader, reader.uint32());
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
message.body = reader.string();
|
|
||||||
break;
|
|
||||||
case 12:
|
|
||||||
message.response_body = reader.string();
|
|
||||||
break;
|
|
||||||
case 11:
|
|
||||||
message.additional_bindings.push(
|
|
||||||
HttpRule.decode(reader, reader.uint32())
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): HttpRule {
|
|
||||||
const message = { ...baseHttpRule } as HttpRule;
|
|
||||||
message.additional_bindings = [];
|
|
||||||
if (object.selector !== undefined && object.selector !== null) {
|
|
||||||
message.selector = String(object.selector);
|
|
||||||
} else {
|
|
||||||
message.selector = "";
|
|
||||||
}
|
|
||||||
if (object.get !== undefined && object.get !== null) {
|
|
||||||
message.get = String(object.get);
|
|
||||||
} else {
|
|
||||||
message.get = undefined;
|
|
||||||
}
|
|
||||||
if (object.put !== undefined && object.put !== null) {
|
|
||||||
message.put = String(object.put);
|
|
||||||
} else {
|
|
||||||
message.put = undefined;
|
|
||||||
}
|
|
||||||
if (object.post !== undefined && object.post !== null) {
|
|
||||||
message.post = String(object.post);
|
|
||||||
} else {
|
|
||||||
message.post = undefined;
|
|
||||||
}
|
|
||||||
if (object.delete !== undefined && object.delete !== null) {
|
|
||||||
message.delete = String(object.delete);
|
|
||||||
} else {
|
|
||||||
message.delete = undefined;
|
|
||||||
}
|
|
||||||
if (object.patch !== undefined && object.patch !== null) {
|
|
||||||
message.patch = String(object.patch);
|
|
||||||
} else {
|
|
||||||
message.patch = undefined;
|
|
||||||
}
|
|
||||||
if (object.custom !== undefined && object.custom !== null) {
|
|
||||||
message.custom = CustomHttpPattern.fromJSON(object.custom);
|
|
||||||
} else {
|
|
||||||
message.custom = undefined;
|
|
||||||
}
|
|
||||||
if (object.body !== undefined && object.body !== null) {
|
|
||||||
message.body = String(object.body);
|
|
||||||
} else {
|
|
||||||
message.body = "";
|
|
||||||
}
|
|
||||||
if (object.response_body !== undefined && object.response_body !== null) {
|
|
||||||
message.response_body = String(object.response_body);
|
|
||||||
} else {
|
|
||||||
message.response_body = "";
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.additional_bindings !== undefined &&
|
|
||||||
object.additional_bindings !== null
|
|
||||||
) {
|
|
||||||
for (const e of object.additional_bindings) {
|
|
||||||
message.additional_bindings.push(HttpRule.fromJSON(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: HttpRule): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.selector !== undefined && (obj.selector = message.selector);
|
|
||||||
message.get !== undefined && (obj.get = message.get);
|
|
||||||
message.put !== undefined && (obj.put = message.put);
|
|
||||||
message.post !== undefined && (obj.post = message.post);
|
|
||||||
message.delete !== undefined && (obj.delete = message.delete);
|
|
||||||
message.patch !== undefined && (obj.patch = message.patch);
|
|
||||||
message.custom !== undefined &&
|
|
||||||
(obj.custom = message.custom
|
|
||||||
? CustomHttpPattern.toJSON(message.custom)
|
|
||||||
: undefined);
|
|
||||||
message.body !== undefined && (obj.body = message.body);
|
|
||||||
message.response_body !== undefined &&
|
|
||||||
(obj.response_body = message.response_body);
|
|
||||||
if (message.additional_bindings) {
|
|
||||||
obj.additional_bindings = message.additional_bindings.map((e) =>
|
|
||||||
e ? HttpRule.toJSON(e) : undefined
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
obj.additional_bindings = [];
|
|
||||||
}
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<HttpRule>): HttpRule {
|
|
||||||
const message = { ...baseHttpRule } as HttpRule;
|
|
||||||
message.additional_bindings = [];
|
|
||||||
if (object.selector !== undefined && object.selector !== null) {
|
|
||||||
message.selector = object.selector;
|
|
||||||
} else {
|
|
||||||
message.selector = "";
|
|
||||||
}
|
|
||||||
if (object.get !== undefined && object.get !== null) {
|
|
||||||
message.get = object.get;
|
|
||||||
} else {
|
|
||||||
message.get = undefined;
|
|
||||||
}
|
|
||||||
if (object.put !== undefined && object.put !== null) {
|
|
||||||
message.put = object.put;
|
|
||||||
} else {
|
|
||||||
message.put = undefined;
|
|
||||||
}
|
|
||||||
if (object.post !== undefined && object.post !== null) {
|
|
||||||
message.post = object.post;
|
|
||||||
} else {
|
|
||||||
message.post = undefined;
|
|
||||||
}
|
|
||||||
if (object.delete !== undefined && object.delete !== null) {
|
|
||||||
message.delete = object.delete;
|
|
||||||
} else {
|
|
||||||
message.delete = undefined;
|
|
||||||
}
|
|
||||||
if (object.patch !== undefined && object.patch !== null) {
|
|
||||||
message.patch = object.patch;
|
|
||||||
} else {
|
|
||||||
message.patch = undefined;
|
|
||||||
}
|
|
||||||
if (object.custom !== undefined && object.custom !== null) {
|
|
||||||
message.custom = CustomHttpPattern.fromPartial(object.custom);
|
|
||||||
} else {
|
|
||||||
message.custom = undefined;
|
|
||||||
}
|
|
||||||
if (object.body !== undefined && object.body !== null) {
|
|
||||||
message.body = object.body;
|
|
||||||
} else {
|
|
||||||
message.body = "";
|
|
||||||
}
|
|
||||||
if (object.response_body !== undefined && object.response_body !== null) {
|
|
||||||
message.response_body = object.response_body;
|
|
||||||
} else {
|
|
||||||
message.response_body = "";
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.additional_bindings !== undefined &&
|
|
||||||
object.additional_bindings !== null
|
|
||||||
) {
|
|
||||||
for (const e of object.additional_bindings) {
|
|
||||||
message.additional_bindings.push(HttpRule.fromPartial(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseCustomHttpPattern: object = { kind: "", path: "" };
|
|
||||||
|
|
||||||
export const CustomHttpPattern = {
|
|
||||||
encode(message: CustomHttpPattern, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.kind !== "") {
|
|
||||||
writer.uint32(10).string(message.kind);
|
|
||||||
}
|
|
||||||
if (message.path !== "") {
|
|
||||||
writer.uint32(18).string(message.path);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): CustomHttpPattern {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseCustomHttpPattern } as CustomHttpPattern;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.kind = reader.string();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.path = reader.string();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): CustomHttpPattern {
|
|
||||||
const message = { ...baseCustomHttpPattern } as CustomHttpPattern;
|
|
||||||
if (object.kind !== undefined && object.kind !== null) {
|
|
||||||
message.kind = String(object.kind);
|
|
||||||
} else {
|
|
||||||
message.kind = "";
|
|
||||||
}
|
|
||||||
if (object.path !== undefined && object.path !== null) {
|
|
||||||
message.path = String(object.path);
|
|
||||||
} else {
|
|
||||||
message.path = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: CustomHttpPattern): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.kind !== undefined && (obj.kind = message.kind);
|
|
||||||
message.path !== undefined && (obj.path = message.path);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<CustomHttpPattern>): CustomHttpPattern {
|
|
||||||
const message = { ...baseCustomHttpPattern } as CustomHttpPattern;
|
|
||||||
if (object.kind !== undefined && object.kind !== null) {
|
|
||||||
message.kind = object.kind;
|
|
||||||
} else {
|
|
||||||
message.kind = "";
|
|
||||||
}
|
|
||||||
if (object.path !== undefined && object.path !== null) {
|
|
||||||
message.path = object.path;
|
|
||||||
} else {
|
|
||||||
message.path = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
||||||
export type DeepPartial<T> = T extends Builtin
|
|
||||||
? T
|
|
||||||
: T extends Array<infer U>
|
|
||||||
? Array<DeepPartial<U>>
|
|
||||||
: T extends ReadonlyArray<infer U>
|
|
||||||
? ReadonlyArray<DeepPartial<U>>
|
|
||||||
: T extends {}
|
|
||||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
||||||
: Partial<T>;
|
|
|
@ -1,240 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import { Writer, Reader } from "protobufjs/minimal";
|
|
||||||
|
|
||||||
export const protobufPackage = "google.protobuf";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* `Any` contains an arbitrary serialized protocol buffer message along with a
|
|
||||||
* URL that describes the type of the serialized message.
|
|
||||||
*
|
|
||||||
* Protobuf library provides support to pack/unpack Any values in the form
|
|
||||||
* of utility functions or additional generated methods of the Any type.
|
|
||||||
*
|
|
||||||
* Example 1: Pack and unpack a message in C++.
|
|
||||||
*
|
|
||||||
* Foo foo = ...;
|
|
||||||
* Any any;
|
|
||||||
* any.PackFrom(foo);
|
|
||||||
* ...
|
|
||||||
* if (any.UnpackTo(&foo)) {
|
|
||||||
* ...
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* Example 2: Pack and unpack a message in Java.
|
|
||||||
*
|
|
||||||
* Foo foo = ...;
|
|
||||||
* Any any = Any.pack(foo);
|
|
||||||
* ...
|
|
||||||
* if (any.is(Foo.class)) {
|
|
||||||
* foo = any.unpack(Foo.class);
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* Example 3: Pack and unpack a message in Python.
|
|
||||||
*
|
|
||||||
* foo = Foo(...)
|
|
||||||
* any = Any()
|
|
||||||
* any.Pack(foo)
|
|
||||||
* ...
|
|
||||||
* if any.Is(Foo.DESCRIPTOR):
|
|
||||||
* any.Unpack(foo)
|
|
||||||
* ...
|
|
||||||
*
|
|
||||||
* Example 4: Pack and unpack a message in Go
|
|
||||||
*
|
|
||||||
* foo := &pb.Foo{...}
|
|
||||||
* any, err := anypb.New(foo)
|
|
||||||
* if err != nil {
|
|
||||||
* ...
|
|
||||||
* }
|
|
||||||
* ...
|
|
||||||
* foo := &pb.Foo{}
|
|
||||||
* if err := any.UnmarshalTo(foo); err != nil {
|
|
||||||
* ...
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* The pack methods provided by protobuf library will by default use
|
|
||||||
* 'type.googleapis.com/full.type.name' as the type URL and the unpack
|
|
||||||
* methods only use the fully qualified type name after the last '/'
|
|
||||||
* in the type URL, for example "foo.bar.com/x/y.z" will yield type
|
|
||||||
* name "y.z".
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* JSON
|
|
||||||
* ====
|
|
||||||
* The JSON representation of an `Any` value uses the regular
|
|
||||||
* representation of the deserialized, embedded message, with an
|
|
||||||
* additional field `@type` which contains the type URL. Example:
|
|
||||||
*
|
|
||||||
* package google.profile;
|
|
||||||
* message Person {
|
|
||||||
* string first_name = 1;
|
|
||||||
* string last_name = 2;
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* {
|
|
||||||
* "@type": "type.googleapis.com/google.profile.Person",
|
|
||||||
* "firstName": <string>,
|
|
||||||
* "lastName": <string>
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* If the embedded message type is well-known and has a custom JSON
|
|
||||||
* representation, that representation will be embedded adding a field
|
|
||||||
* `value` which holds the custom JSON in addition to the `@type`
|
|
||||||
* field. Example (for message [google.protobuf.Duration][]):
|
|
||||||
*
|
|
||||||
* {
|
|
||||||
* "@type": "type.googleapis.com/google.protobuf.Duration",
|
|
||||||
* "value": "1.212s"
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
export interface Any {
|
|
||||||
/**
|
|
||||||
* A URL/resource name that uniquely identifies the type of the serialized
|
|
||||||
* protocol buffer message. This string must contain at least
|
|
||||||
* one "/" character. The last segment of the URL's path must represent
|
|
||||||
* the fully qualified name of the type (as in
|
|
||||||
* `path/google.protobuf.Duration`). The name should be in a canonical form
|
|
||||||
* (e.g., leading "." is not accepted).
|
|
||||||
*
|
|
||||||
* In practice, teams usually precompile into the binary all types that they
|
|
||||||
* expect it to use in the context of Any. However, for URLs which use the
|
|
||||||
* scheme `http`, `https`, or no scheme, one can optionally set up a type
|
|
||||||
* server that maps type URLs to message definitions as follows:
|
|
||||||
*
|
|
||||||
* * If no scheme is provided, `https` is assumed.
|
|
||||||
* * An HTTP GET on the URL must yield a [google.protobuf.Type][]
|
|
||||||
* value in binary format, or produce an error.
|
|
||||||
* * Applications are allowed to cache lookup results based on the
|
|
||||||
* URL, or have them precompiled into a binary to avoid any
|
|
||||||
* lookup. Therefore, binary compatibility needs to be preserved
|
|
||||||
* on changes to types. (Use versioned type names to manage
|
|
||||||
* breaking changes.)
|
|
||||||
*
|
|
||||||
* Note: this functionality is not currently available in the official
|
|
||||||
* protobuf release, and it is not used for type URLs beginning with
|
|
||||||
* type.googleapis.com.
|
|
||||||
*
|
|
||||||
* Schemes other than `http`, `https` (or the empty scheme) might be
|
|
||||||
* used with implementation specific semantics.
|
|
||||||
*/
|
|
||||||
type_url: string;
|
|
||||||
/** Must be a valid serialized protocol buffer of the above specified type. */
|
|
||||||
value: Uint8Array;
|
|
||||||
}
|
|
||||||
|
|
||||||
const baseAny: object = { type_url: "" };
|
|
||||||
|
|
||||||
export const Any = {
|
|
||||||
encode(message: Any, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.type_url !== "") {
|
|
||||||
writer.uint32(10).string(message.type_url);
|
|
||||||
}
|
|
||||||
if (message.value.length !== 0) {
|
|
||||||
writer.uint32(18).bytes(message.value);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): Any {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseAny } as Any;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.type_url = reader.string();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.value = reader.bytes();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): Any {
|
|
||||||
const message = { ...baseAny } as Any;
|
|
||||||
if (object.type_url !== undefined && object.type_url !== null) {
|
|
||||||
message.type_url = String(object.type_url);
|
|
||||||
} else {
|
|
||||||
message.type_url = "";
|
|
||||||
}
|
|
||||||
if (object.value !== undefined && object.value !== null) {
|
|
||||||
message.value = bytesFromBase64(object.value);
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: Any): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.type_url !== undefined && (obj.type_url = message.type_url);
|
|
||||||
message.value !== undefined &&
|
|
||||||
(obj.value = base64FromBytes(
|
|
||||||
message.value !== undefined ? message.value : new Uint8Array()
|
|
||||||
));
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<Any>): Any {
|
|
||||||
const message = { ...baseAny } as Any;
|
|
||||||
if (object.type_url !== undefined && object.type_url !== null) {
|
|
||||||
message.type_url = object.type_url;
|
|
||||||
} else {
|
|
||||||
message.type_url = "";
|
|
||||||
}
|
|
||||||
if (object.value !== undefined && object.value !== null) {
|
|
||||||
message.value = object.value;
|
|
||||||
} else {
|
|
||||||
message.value = new Uint8Array();
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
declare var self: any | undefined;
|
|
||||||
declare var window: any | undefined;
|
|
||||||
var globalThis: any = (() => {
|
|
||||||
if (typeof globalThis !== "undefined") return globalThis;
|
|
||||||
if (typeof self !== "undefined") return self;
|
|
||||||
if (typeof window !== "undefined") return window;
|
|
||||||
if (typeof global !== "undefined") return global;
|
|
||||||
throw "Unable to locate global object";
|
|
||||||
})();
|
|
||||||
|
|
||||||
const atob: (b64: string) => string =
|
|
||||||
globalThis.atob ||
|
|
||||||
((b64) => globalThis.Buffer.from(b64, "base64").toString("binary"));
|
|
||||||
function bytesFromBase64(b64: string): Uint8Array {
|
|
||||||
const bin = atob(b64);
|
|
||||||
const arr = new Uint8Array(bin.length);
|
|
||||||
for (let i = 0; i < bin.length; ++i) {
|
|
||||||
arr[i] = bin.charCodeAt(i);
|
|
||||||
}
|
|
||||||
return arr;
|
|
||||||
}
|
|
||||||
|
|
||||||
const btoa: (bin: string) => string =
|
|
||||||
globalThis.btoa ||
|
|
||||||
((bin) => globalThis.Buffer.from(bin, "binary").toString("base64"));
|
|
||||||
function base64FromBytes(arr: Uint8Array): string {
|
|
||||||
const bin: string[] = [];
|
|
||||||
for (let i = 0; i < arr.byteLength; ++i) {
|
|
||||||
bin.push(String.fromCharCode(arr[i]));
|
|
||||||
}
|
|
||||||
return btoa(bin.join(""));
|
|
||||||
}
|
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
||||||
export type DeepPartial<T> = T extends Builtin
|
|
||||||
? T
|
|
||||||
: T extends Array<infer U>
|
|
||||||
? Array<DeepPartial<U>>
|
|
||||||
: T extends ReadonlyArray<infer U>
|
|
||||||
? ReadonlyArray<DeepPartial<U>>
|
|
||||||
: T extends {}
|
|
||||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
||||||
: Partial<T>;
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,18 +0,0 @@
|
||||||
{
|
|
||||||
"name": "cosmos-auth-v1beta1-js",
|
|
||||||
"version": "0.1.0",
|
|
||||||
"description": "Autogenerated vuex store for Cosmos module cosmos.auth.v1beta1",
|
|
||||||
"author": "Starport Codegen <hello@tendermint.com>",
|
|
||||||
"homepage": "http://github.com/cosmos/cosmos-sdk/x/auth/types",
|
|
||||||
"license": "Apache-2.0",
|
|
||||||
"licenses": [
|
|
||||||
{
|
|
||||||
"type": "Apache-2.0",
|
|
||||||
"url": "http://www.apache.org/licenses/LICENSE-2.0"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"main": "index.js",
|
|
||||||
"publishConfig": {
|
|
||||||
"access": "public"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
THIS FILE IS GENERATED AUTOMATICALLY. DO NOT DELETE.
|
|
|
@ -1,403 +0,0 @@
|
||||||
import { txClient, queryClient, MissingWalletError , registry} from './module'
|
|
||||||
|
|
||||||
import { SendAuthorization } from "./module/types/cosmos/bank/v1beta1/authz"
|
|
||||||
import { Params } from "./module/types/cosmos/bank/v1beta1/bank"
|
|
||||||
import { SendEnabled } from "./module/types/cosmos/bank/v1beta1/bank"
|
|
||||||
import { Input } from "./module/types/cosmos/bank/v1beta1/bank"
|
|
||||||
import { Output } from "./module/types/cosmos/bank/v1beta1/bank"
|
|
||||||
import { Supply } from "./module/types/cosmos/bank/v1beta1/bank"
|
|
||||||
import { DenomUnit } from "./module/types/cosmos/bank/v1beta1/bank"
|
|
||||||
import { Metadata } from "./module/types/cosmos/bank/v1beta1/bank"
|
|
||||||
import { Balance } from "./module/types/cosmos/bank/v1beta1/genesis"
|
|
||||||
|
|
||||||
|
|
||||||
export { SendAuthorization, Params, SendEnabled, Input, Output, Supply, DenomUnit, Metadata, Balance };
|
|
||||||
|
|
||||||
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 {
|
|
||||||
Balance: {},
|
|
||||||
AllBalances: {},
|
|
||||||
TotalSupply: {},
|
|
||||||
SupplyOf: {},
|
|
||||||
Params: {},
|
|
||||||
DenomMetadata: {},
|
|
||||||
DenomsMetadata: {},
|
|
||||||
|
|
||||||
_Structure: {
|
|
||||||
SendAuthorization: getStructure(SendAuthorization.fromPartial({})),
|
|
||||||
Params: getStructure(Params.fromPartial({})),
|
|
||||||
SendEnabled: getStructure(SendEnabled.fromPartial({})),
|
|
||||||
Input: getStructure(Input.fromPartial({})),
|
|
||||||
Output: getStructure(Output.fromPartial({})),
|
|
||||||
Supply: getStructure(Supply.fromPartial({})),
|
|
||||||
DenomUnit: getStructure(DenomUnit.fromPartial({})),
|
|
||||||
Metadata: getStructure(Metadata.fromPartial({})),
|
|
||||||
Balance: getStructure(Balance.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: {
|
|
||||||
getBalance: (state) => (params = { params: {}}) => {
|
|
||||||
if (!(<any> params).query) {
|
|
||||||
(<any> params).query=null
|
|
||||||
}
|
|
||||||
return state.Balance[JSON.stringify(params)] ?? {}
|
|
||||||
},
|
|
||||||
getAllBalances: (state) => (params = { params: {}}) => {
|
|
||||||
if (!(<any> params).query) {
|
|
||||||
(<any> params).query=null
|
|
||||||
}
|
|
||||||
return state.AllBalances[JSON.stringify(params)] ?? {}
|
|
||||||
},
|
|
||||||
getTotalSupply: (state) => (params = { params: {}}) => {
|
|
||||||
if (!(<any> params).query) {
|
|
||||||
(<any> params).query=null
|
|
||||||
}
|
|
||||||
return state.TotalSupply[JSON.stringify(params)] ?? {}
|
|
||||||
},
|
|
||||||
getSupplyOf: (state) => (params = { params: {}}) => {
|
|
||||||
if (!(<any> params).query) {
|
|
||||||
(<any> params).query=null
|
|
||||||
}
|
|
||||||
return state.SupplyOf[JSON.stringify(params)] ?? {}
|
|
||||||
},
|
|
||||||
getParams: (state) => (params = { params: {}}) => {
|
|
||||||
if (!(<any> params).query) {
|
|
||||||
(<any> params).query=null
|
|
||||||
}
|
|
||||||
return state.Params[JSON.stringify(params)] ?? {}
|
|
||||||
},
|
|
||||||
getDenomMetadata: (state) => (params = { params: {}}) => {
|
|
||||||
if (!(<any> params).query) {
|
|
||||||
(<any> params).query=null
|
|
||||||
}
|
|
||||||
return state.DenomMetadata[JSON.stringify(params)] ?? {}
|
|
||||||
},
|
|
||||||
getDenomsMetadata: (state) => (params = { params: {}}) => {
|
|
||||||
if (!(<any> params).query) {
|
|
||||||
(<any> params).query=null
|
|
||||||
}
|
|
||||||
return state.DenomsMetadata[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.bank.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 QueryBalance({ 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.queryBalance( key.address, query)).data
|
|
||||||
|
|
||||||
|
|
||||||
while (all && (<any> value).pagination && (<any> value).pagination.next_key!=null) {
|
|
||||||
let next_values=(await queryClient.queryBalance( key.address, {...query, 'pagination.key':(<any> value).pagination.next_key})).data
|
|
||||||
value = mergeResults(value, next_values);
|
|
||||||
}
|
|
||||||
commit('QUERY', { query: 'Balance', key: { params: {...key}, query}, value })
|
|
||||||
if (subscribe) commit('SUBSCRIBE', { action: 'QueryBalance', payload: { options: { all }, params: {...key},query }})
|
|
||||||
return getters['getBalance']( { params: {...key}, query}) ?? {}
|
|
||||||
} catch (e) {
|
|
||||||
throw new Error('QueryClient:QueryBalance API Node Unavailable. Could not perform query: ' + e.message)
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async QueryAllBalances({ 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.queryAllBalances( key.address, query)).data
|
|
||||||
|
|
||||||
|
|
||||||
while (all && (<any> value).pagination && (<any> value).pagination.next_key!=null) {
|
|
||||||
let next_values=(await queryClient.queryAllBalances( key.address, {...query, 'pagination.key':(<any> value).pagination.next_key})).data
|
|
||||||
value = mergeResults(value, next_values);
|
|
||||||
}
|
|
||||||
commit('QUERY', { query: 'AllBalances', key: { params: {...key}, query}, value })
|
|
||||||
if (subscribe) commit('SUBSCRIBE', { action: 'QueryAllBalances', payload: { options: { all }, params: {...key},query }})
|
|
||||||
return getters['getAllBalances']( { params: {...key}, query}) ?? {}
|
|
||||||
} catch (e) {
|
|
||||||
throw new Error('QueryClient:QueryAllBalances API Node Unavailable. Could not perform query: ' + e.message)
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async QueryTotalSupply({ 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.queryTotalSupply(query)).data
|
|
||||||
|
|
||||||
|
|
||||||
while (all && (<any> value).pagination && (<any> value).pagination.next_key!=null) {
|
|
||||||
let next_values=(await queryClient.queryTotalSupply({...query, 'pagination.key':(<any> value).pagination.next_key})).data
|
|
||||||
value = mergeResults(value, next_values);
|
|
||||||
}
|
|
||||||
commit('QUERY', { query: 'TotalSupply', key: { params: {...key}, query}, value })
|
|
||||||
if (subscribe) commit('SUBSCRIBE', { action: 'QueryTotalSupply', payload: { options: { all }, params: {...key},query }})
|
|
||||||
return getters['getTotalSupply']( { params: {...key}, query}) ?? {}
|
|
||||||
} catch (e) {
|
|
||||||
throw new Error('QueryClient:QueryTotalSupply API Node Unavailable. Could not perform query: ' + e.message)
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async QuerySupplyOf({ 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.querySupplyOf( key.denom)).data
|
|
||||||
|
|
||||||
|
|
||||||
commit('QUERY', { query: 'SupplyOf', key: { params: {...key}, query}, value })
|
|
||||||
if (subscribe) commit('SUBSCRIBE', { action: 'QuerySupplyOf', payload: { options: { all }, params: {...key},query }})
|
|
||||||
return getters['getSupplyOf']( { params: {...key}, query}) ?? {}
|
|
||||||
} catch (e) {
|
|
||||||
throw new Error('QueryClient:QuerySupplyOf 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 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 Error('QueryClient:QueryParams API Node Unavailable. Could not perform query: ' + e.message)
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async QueryDenomMetadata({ 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.queryDenomMetadata( key.denom)).data
|
|
||||||
|
|
||||||
|
|
||||||
commit('QUERY', { query: 'DenomMetadata', key: { params: {...key}, query}, value })
|
|
||||||
if (subscribe) commit('SUBSCRIBE', { action: 'QueryDenomMetadata', payload: { options: { all }, params: {...key},query }})
|
|
||||||
return getters['getDenomMetadata']( { params: {...key}, query}) ?? {}
|
|
||||||
} catch (e) {
|
|
||||||
throw new Error('QueryClient:QueryDenomMetadata API Node Unavailable. Could not perform query: ' + e.message)
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async QueryDenomsMetadata({ 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.queryDenomsMetadata(query)).data
|
|
||||||
|
|
||||||
|
|
||||||
while (all && (<any> value).pagination && (<any> value).pagination.next_key!=null) {
|
|
||||||
let next_values=(await queryClient.queryDenomsMetadata({...query, 'pagination.key':(<any> value).pagination.next_key})).data
|
|
||||||
value = mergeResults(value, next_values);
|
|
||||||
}
|
|
||||||
commit('QUERY', { query: 'DenomsMetadata', key: { params: {...key}, query}, value })
|
|
||||||
if (subscribe) commit('SUBSCRIBE', { action: 'QueryDenomsMetadata', payload: { options: { all }, params: {...key},query }})
|
|
||||||
return getters['getDenomsMetadata']( { params: {...key}, query}) ?? {}
|
|
||||||
} catch (e) {
|
|
||||||
throw new Error('QueryClient:QueryDenomsMetadata API Node Unavailable. Could not perform query: ' + e.message)
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
async sendMsgMultiSend({ rootGetters }, { value, fee = [], memo = '' }) {
|
|
||||||
try {
|
|
||||||
const txClient=await initTxClient(rootGetters)
|
|
||||||
const msg = await txClient.msgMultiSend(value)
|
|
||||||
const result = await txClient.signAndBroadcast([msg], {fee: { amount: fee,
|
|
||||||
gas: "200000" }, memo})
|
|
||||||
return result
|
|
||||||
} catch (e) {
|
|
||||||
if (e == MissingWalletError) {
|
|
||||||
throw new Error('TxClient:MsgMultiSend:Init Could not initialize signing client. Wallet is required.')
|
|
||||||
}else{
|
|
||||||
throw new Error('TxClient:MsgMultiSend:Send Could not broadcast Tx: '+ e.message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async sendMsgSend({ rootGetters }, { value, fee = [], memo = '' }) {
|
|
||||||
try {
|
|
||||||
const txClient=await initTxClient(rootGetters)
|
|
||||||
const msg = await txClient.msgSend(value)
|
|
||||||
const result = await txClient.signAndBroadcast([msg], {fee: { amount: fee,
|
|
||||||
gas: "200000" }, memo})
|
|
||||||
return result
|
|
||||||
} catch (e) {
|
|
||||||
if (e == MissingWalletError) {
|
|
||||||
throw new Error('TxClient:MsgSend:Init Could not initialize signing client. Wallet is required.')
|
|
||||||
}else{
|
|
||||||
throw new Error('TxClient:MsgSend:Send Could not broadcast Tx: '+ e.message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
async MsgMultiSend({ rootGetters }, { value }) {
|
|
||||||
try {
|
|
||||||
const txClient=await initTxClient(rootGetters)
|
|
||||||
const msg = await txClient.msgMultiSend(value)
|
|
||||||
return msg
|
|
||||||
} catch (e) {
|
|
||||||
if (e == MissingWalletError) {
|
|
||||||
throw new Error('TxClient:MsgMultiSend:Init Could not initialize signing client. Wallet is required.')
|
|
||||||
}else{
|
|
||||||
throw new Error('TxClient:MsgMultiSend:Create Could not create message: ' + e.message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async MsgSend({ rootGetters }, { value }) {
|
|
||||||
try {
|
|
||||||
const txClient=await initTxClient(rootGetters)
|
|
||||||
const msg = await txClient.msgSend(value)
|
|
||||||
return msg
|
|
||||||
} catch (e) {
|
|
||||||
if (e == MissingWalletError) {
|
|
||||||
throw new Error('TxClient:MsgSend:Init Could not initialize signing client. Wallet is required.')
|
|
||||||
}else{
|
|
||||||
throw new Error('TxClient:MsgSend:Create Could not create message: ' + e.message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,63 +0,0 @@
|
||||||
// THIS FILE IS GENERATED AUTOMATICALLY. DO NOT MODIFY.
|
|
||||||
|
|
||||||
import { StdFee } from "@cosmjs/launchpad";
|
|
||||||
import { SigningStargateClient } from "@cosmjs/stargate";
|
|
||||||
import { Registry, OfflineSigner, EncodeObject, DirectSecp256k1HdWallet } from "@cosmjs/proto-signing";
|
|
||||||
import { Api } from "./rest";
|
|
||||||
import { MsgMultiSend } from "./types/cosmos/bank/v1beta1/tx";
|
|
||||||
import { MsgSend } from "./types/cosmos/bank/v1beta1/tx";
|
|
||||||
|
|
||||||
|
|
||||||
const types = [
|
|
||||||
["/cosmos.bank.v1beta1.MsgMultiSend", MsgMultiSend],
|
|
||||||
["/cosmos.bank.v1beta1.MsgSend", MsgSend],
|
|
||||||
|
|
||||||
];
|
|
||||||
export const MissingWalletError = new Error("wallet is required");
|
|
||||||
|
|
||||||
export const registry = new Registry(<any>types);
|
|
||||||
|
|
||||||
const defaultFee = {
|
|
||||||
amount: [],
|
|
||||||
gas: "200000",
|
|
||||||
};
|
|
||||||
|
|
||||||
interface TxClientOptions {
|
|
||||||
addr: string
|
|
||||||
}
|
|
||||||
|
|
||||||
interface SignAndBroadcastOptions {
|
|
||||||
fee: StdFee,
|
|
||||||
memo?: string
|
|
||||||
}
|
|
||||||
|
|
||||||
const txClient = async (wallet: OfflineSigner, { addr: addr }: TxClientOptions = { addr: "http://localhost:26657" }) => {
|
|
||||||
if (!wallet) throw MissingWalletError;
|
|
||||||
let client;
|
|
||||||
if (addr) {
|
|
||||||
client = await SigningStargateClient.connectWithSigner(addr, wallet, { registry });
|
|
||||||
}else{
|
|
||||||
client = await SigningStargateClient.offline( wallet, { registry });
|
|
||||||
}
|
|
||||||
const { address } = (await wallet.getAccounts())[0];
|
|
||||||
|
|
||||||
return {
|
|
||||||
signAndBroadcast: (msgs: EncodeObject[], { fee, memo }: SignAndBroadcastOptions = {fee: defaultFee, memo: ""}) => client.signAndBroadcast(address, msgs, fee,memo),
|
|
||||||
msgMultiSend: (data: MsgMultiSend): EncodeObject => ({ typeUrl: "/cosmos.bank.v1beta1.MsgMultiSend", value: MsgMultiSend.fromPartial( data ) }),
|
|
||||||
msgSend: (data: MsgSend): EncodeObject => ({ typeUrl: "/cosmos.bank.v1beta1.MsgSend", value: MsgSend.fromPartial( data ) }),
|
|
||||||
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
interface QueryClientOptions {
|
|
||||||
addr: string
|
|
||||||
}
|
|
||||||
|
|
||||||
const queryClient = async ({ addr: addr }: QueryClientOptions = { addr: "http://localhost:1317" }) => {
|
|
||||||
return new Api({ baseUrl: addr });
|
|
||||||
};
|
|
||||||
|
|
||||||
export {
|
|
||||||
txClient,
|
|
||||||
queryClient,
|
|
||||||
};
|
|
|
@ -1,596 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
/* tslint:disable */
|
|
||||||
/*
|
|
||||||
* ---------------------------------------------------------------
|
|
||||||
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
|
|
||||||
* ## ##
|
|
||||||
* ## AUTHOR: acacode ##
|
|
||||||
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
|
|
||||||
* ---------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
export interface ProtobufAny {
|
|
||||||
"@type"?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface RpcStatus {
|
|
||||||
/** @format int32 */
|
|
||||||
code?: number;
|
|
||||||
message?: string;
|
|
||||||
details?: ProtobufAny[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Coin defines a token with a denomination and an amount.
|
|
||||||
|
|
||||||
NOTE: The amount field is an Int which implements the custom method
|
|
||||||
signatures required by gogoproto.
|
|
||||||
*/
|
|
||||||
export interface V1Beta1Coin {
|
|
||||||
denom?: string;
|
|
||||||
amount?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* DenomUnit represents a struct that describes a given
|
|
||||||
denomination unit of the basic token.
|
|
||||||
*/
|
|
||||||
export interface V1Beta1DenomUnit {
|
|
||||||
/** denom represents the string name of the given denom unit (e.g uatom). */
|
|
||||||
denom?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* exponent represents power of 10 exponent that one must
|
|
||||||
* raise the base_denom to in order to equal the given DenomUnit's denom
|
|
||||||
* 1 denom = 1^exponent base_denom
|
|
||||||
* (e.g. with a base_denom of uatom, one can create a DenomUnit of 'atom' with
|
|
||||||
* exponent = 6, thus: 1 atom = 10^6 uatom).
|
|
||||||
* @format int64
|
|
||||||
*/
|
|
||||||
exponent?: number;
|
|
||||||
aliases?: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Input models transaction input.
|
|
||||||
*/
|
|
||||||
export interface V1Beta1Input {
|
|
||||||
address?: string;
|
|
||||||
coins?: V1Beta1Coin[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Metadata represents a struct that describes
|
|
||||||
a basic token.
|
|
||||||
*/
|
|
||||||
export interface V1Beta1Metadata {
|
|
||||||
description?: string;
|
|
||||||
denom_units?: V1Beta1DenomUnit[];
|
|
||||||
|
|
||||||
/** base represents the base denom (should be the DenomUnit with exponent = 0). */
|
|
||||||
base?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* display indicates the suggested denom that should be
|
|
||||||
* displayed in clients.
|
|
||||||
*/
|
|
||||||
display?: string;
|
|
||||||
|
|
||||||
/** Since: cosmos-sdk 0.43 */
|
|
||||||
name?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* symbol is the token symbol usually shown on exchanges (eg: ATOM). This can
|
|
||||||
* be the same as the display.
|
|
||||||
*
|
|
||||||
* Since: cosmos-sdk 0.43
|
|
||||||
*/
|
|
||||||
symbol?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* MsgMultiSendResponse defines the Msg/MultiSend response type.
|
|
||||||
*/
|
|
||||||
export type V1Beta1MsgMultiSendResponse = object;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* MsgSendResponse defines the Msg/Send response type.
|
|
||||||
*/
|
|
||||||
export type V1Beta1MsgSendResponse = object;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Output models transaction outputs.
|
|
||||||
*/
|
|
||||||
export interface V1Beta1Output {
|
|
||||||
address?: string;
|
|
||||||
coins?: V1Beta1Coin[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* message SomeRequest {
|
|
||||||
Foo some_parameter = 1;
|
|
||||||
PageRequest pagination = 2;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
export interface V1Beta1PageRequest {
|
|
||||||
/**
|
|
||||||
* key is a value returned in PageResponse.next_key to begin
|
|
||||||
* querying the next page most efficiently. Only one of offset or key
|
|
||||||
* should be set.
|
|
||||||
* @format byte
|
|
||||||
*/
|
|
||||||
key?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* offset is a numeric offset that can be used when key is unavailable.
|
|
||||||
* It is less efficient than using key. Only one of offset or key should
|
|
||||||
* be set.
|
|
||||||
* @format uint64
|
|
||||||
*/
|
|
||||||
offset?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* limit is the total number of results to be returned in the result page.
|
|
||||||
* If left empty it will default to a value to be set by each app.
|
|
||||||
* @format uint64
|
|
||||||
*/
|
|
||||||
limit?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* count_total is set to true to indicate that the result set should include
|
|
||||||
* a count of the total number of items available for pagination in UIs.
|
|
||||||
* count_total is only respected when offset is used. It is ignored when key
|
|
||||||
* is set.
|
|
||||||
*/
|
|
||||||
count_total?: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* reverse is set to true if results are to be returned in the descending order.
|
|
||||||
*
|
|
||||||
* Since: cosmos-sdk 0.43
|
|
||||||
*/
|
|
||||||
reverse?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PageResponse is to be embedded in gRPC response messages where the
|
|
||||||
corresponding request message has used PageRequest.
|
|
||||||
|
|
||||||
message SomeResponse {
|
|
||||||
repeated Bar results = 1;
|
|
||||||
PageResponse page = 2;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
export interface V1Beta1PageResponse {
|
|
||||||
/** @format byte */
|
|
||||||
next_key?: string;
|
|
||||||
|
|
||||||
/** @format uint64 */
|
|
||||||
total?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Params defines the parameters for the bank module.
|
|
||||||
*/
|
|
||||||
export interface V1Beta1Params {
|
|
||||||
send_enabled?: V1Beta1SendEnabled[];
|
|
||||||
default_send_enabled?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* QueryAllBalancesResponse is the response type for the Query/AllBalances RPC
|
|
||||||
method.
|
|
||||||
*/
|
|
||||||
export interface V1Beta1QueryAllBalancesResponse {
|
|
||||||
/** balances is the balances of all the coins. */
|
|
||||||
balances?: V1Beta1Coin[];
|
|
||||||
|
|
||||||
/** pagination defines the pagination in the response. */
|
|
||||||
pagination?: V1Beta1PageResponse;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* QueryBalanceResponse is the response type for the Query/Balance RPC method.
|
|
||||||
*/
|
|
||||||
export interface V1Beta1QueryBalanceResponse {
|
|
||||||
/** balance is the balance of the coin. */
|
|
||||||
balance?: V1Beta1Coin;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* QueryDenomMetadataResponse is the response type for the Query/DenomMetadata RPC
|
|
||||||
method.
|
|
||||||
*/
|
|
||||||
export interface V1Beta1QueryDenomMetadataResponse {
|
|
||||||
/** metadata describes and provides all the client information for the requested token. */
|
|
||||||
metadata?: V1Beta1Metadata;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* QueryDenomsMetadataResponse is the response type for the Query/DenomsMetadata RPC
|
|
||||||
method.
|
|
||||||
*/
|
|
||||||
export interface V1Beta1QueryDenomsMetadataResponse {
|
|
||||||
/** metadata provides the client information for all the registered tokens. */
|
|
||||||
metadatas?: V1Beta1Metadata[];
|
|
||||||
|
|
||||||
/** pagination defines the pagination in the response. */
|
|
||||||
pagination?: V1Beta1PageResponse;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* QueryParamsResponse defines the response type for querying x/bank parameters.
|
|
||||||
*/
|
|
||||||
export interface V1Beta1QueryParamsResponse {
|
|
||||||
/** Params defines the parameters for the bank module. */
|
|
||||||
params?: V1Beta1Params;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* QuerySupplyOfResponse is the response type for the Query/SupplyOf RPC method.
|
|
||||||
*/
|
|
||||||
export interface V1Beta1QuerySupplyOfResponse {
|
|
||||||
/** amount is the supply of the coin. */
|
|
||||||
amount?: V1Beta1Coin;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface V1Beta1QueryTotalSupplyResponse {
|
|
||||||
supply?: V1Beta1Coin[];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* pagination defines the pagination in the response.
|
|
||||||
*
|
|
||||||
* Since: cosmos-sdk 0.43
|
|
||||||
*/
|
|
||||||
pagination?: V1Beta1PageResponse;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SendEnabled maps coin denom to a send_enabled status (whether a denom is
|
|
||||||
sendable).
|
|
||||||
*/
|
|
||||||
export interface V1Beta1SendEnabled {
|
|
||||||
denom?: string;
|
|
||||||
enabled?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type QueryParamsType = Record<string | number, any>;
|
|
||||||
export type ResponseFormat = keyof Omit<Body, "body" | "bodyUsed">;
|
|
||||||
|
|
||||||
export interface FullRequestParams extends Omit<RequestInit, "body"> {
|
|
||||||
/** set parameter to `true` for call `securityWorker` for this request */
|
|
||||||
secure?: boolean;
|
|
||||||
/** request path */
|
|
||||||
path: string;
|
|
||||||
/** content type of request body */
|
|
||||||
type?: ContentType;
|
|
||||||
/** query params */
|
|
||||||
query?: QueryParamsType;
|
|
||||||
/** format of response (i.e. response.json() -> format: "json") */
|
|
||||||
format?: keyof Omit<Body, "body" | "bodyUsed">;
|
|
||||||
/** request body */
|
|
||||||
body?: unknown;
|
|
||||||
/** base url */
|
|
||||||
baseUrl?: string;
|
|
||||||
/** request cancellation token */
|
|
||||||
cancelToken?: CancelToken;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type RequestParams = Omit<FullRequestParams, "body" | "method" | "query" | "path">;
|
|
||||||
|
|
||||||
export interface ApiConfig<SecurityDataType = unknown> {
|
|
||||||
baseUrl?: string;
|
|
||||||
baseApiParams?: Omit<RequestParams, "baseUrl" | "cancelToken" | "signal">;
|
|
||||||
securityWorker?: (securityData: SecurityDataType) => RequestParams | void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
|
|
||||||
data: D;
|
|
||||||
error: E;
|
|
||||||
}
|
|
||||||
|
|
||||||
type CancelToken = Symbol | string | number;
|
|
||||||
|
|
||||||
export enum ContentType {
|
|
||||||
Json = "application/json",
|
|
||||||
FormData = "multipart/form-data",
|
|
||||||
UrlEncoded = "application/x-www-form-urlencoded",
|
|
||||||
}
|
|
||||||
|
|
||||||
export class HttpClient<SecurityDataType = unknown> {
|
|
||||||
public baseUrl: string = "";
|
|
||||||
private securityData: SecurityDataType = null as any;
|
|
||||||
private securityWorker: null | ApiConfig<SecurityDataType>["securityWorker"] = null;
|
|
||||||
private abortControllers = new Map<CancelToken, AbortController>();
|
|
||||||
|
|
||||||
private baseApiParams: RequestParams = {
|
|
||||||
credentials: "same-origin",
|
|
||||||
headers: {},
|
|
||||||
redirect: "follow",
|
|
||||||
referrerPolicy: "no-referrer",
|
|
||||||
};
|
|
||||||
|
|
||||||
constructor(apiConfig: ApiConfig<SecurityDataType> = {}) {
|
|
||||||
Object.assign(this, apiConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
public setSecurityData = (data: SecurityDataType) => {
|
|
||||||
this.securityData = data;
|
|
||||||
};
|
|
||||||
|
|
||||||
private addQueryParam(query: QueryParamsType, key: string) {
|
|
||||||
const value = query[key];
|
|
||||||
|
|
||||||
return (
|
|
||||||
encodeURIComponent(key) +
|
|
||||||
"=" +
|
|
||||||
encodeURIComponent(Array.isArray(value) ? value.join(",") : typeof value === "number" ? value : `${value}`)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected toQueryString(rawQuery?: QueryParamsType): string {
|
|
||||||
const query = rawQuery || {};
|
|
||||||
const keys = Object.keys(query).filter((key) => "undefined" !== typeof query[key]);
|
|
||||||
return keys
|
|
||||||
.map((key) =>
|
|
||||||
typeof query[key] === "object" && !Array.isArray(query[key])
|
|
||||||
? this.toQueryString(query[key] as QueryParamsType)
|
|
||||||
: this.addQueryParam(query, key),
|
|
||||||
)
|
|
||||||
.join("&");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected addQueryParams(rawQuery?: QueryParamsType): string {
|
|
||||||
const queryString = this.toQueryString(rawQuery);
|
|
||||||
return queryString ? `?${queryString}` : "";
|
|
||||||
}
|
|
||||||
|
|
||||||
private contentFormatters: Record<ContentType, (input: any) => any> = {
|
|
||||||
[ContentType.Json]: (input: any) =>
|
|
||||||
input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input,
|
|
||||||
[ContentType.FormData]: (input: any) =>
|
|
||||||
Object.keys(input || {}).reduce((data, key) => {
|
|
||||||
data.append(key, input[key]);
|
|
||||||
return data;
|
|
||||||
}, new FormData()),
|
|
||||||
[ContentType.UrlEncoded]: (input: any) => this.toQueryString(input),
|
|
||||||
};
|
|
||||||
|
|
||||||
private mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams {
|
|
||||||
return {
|
|
||||||
...this.baseApiParams,
|
|
||||||
...params1,
|
|
||||||
...(params2 || {}),
|
|
||||||
headers: {
|
|
||||||
...(this.baseApiParams.headers || {}),
|
|
||||||
...(params1.headers || {}),
|
|
||||||
...((params2 && params2.headers) || {}),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private createAbortSignal = (cancelToken: CancelToken): AbortSignal | undefined => {
|
|
||||||
if (this.abortControllers.has(cancelToken)) {
|
|
||||||
const abortController = this.abortControllers.get(cancelToken);
|
|
||||||
if (abortController) {
|
|
||||||
return abortController.signal;
|
|
||||||
}
|
|
||||||
return void 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const abortController = new AbortController();
|
|
||||||
this.abortControllers.set(cancelToken, abortController);
|
|
||||||
return abortController.signal;
|
|
||||||
};
|
|
||||||
|
|
||||||
public abortRequest = (cancelToken: CancelToken) => {
|
|
||||||
const abortController = this.abortControllers.get(cancelToken);
|
|
||||||
|
|
||||||
if (abortController) {
|
|
||||||
abortController.abort();
|
|
||||||
this.abortControllers.delete(cancelToken);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public request = <T = any, E = any>({
|
|
||||||
body,
|
|
||||||
secure,
|
|
||||||
path,
|
|
||||||
type,
|
|
||||||
query,
|
|
||||||
format = "json",
|
|
||||||
baseUrl,
|
|
||||||
cancelToken,
|
|
||||||
...params
|
|
||||||
}: FullRequestParams): Promise<HttpResponse<T, E>> => {
|
|
||||||
const secureParams = (secure && this.securityWorker && this.securityWorker(this.securityData)) || {};
|
|
||||||
const requestParams = this.mergeRequestParams(params, secureParams);
|
|
||||||
const queryString = query && this.toQueryString(query);
|
|
||||||
const payloadFormatter = this.contentFormatters[type || ContentType.Json];
|
|
||||||
|
|
||||||
return fetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, {
|
|
||||||
...requestParams,
|
|
||||||
headers: {
|
|
||||||
...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}),
|
|
||||||
...(requestParams.headers || {}),
|
|
||||||
},
|
|
||||||
signal: cancelToken ? this.createAbortSignal(cancelToken) : void 0,
|
|
||||||
body: typeof body === "undefined" || body === null ? null : payloadFormatter(body),
|
|
||||||
}).then(async (response) => {
|
|
||||||
const r = response as HttpResponse<T, E>;
|
|
||||||
r.data = (null as unknown) as T;
|
|
||||||
r.error = (null as unknown) as E;
|
|
||||||
|
|
||||||
const data = await response[format]()
|
|
||||||
.then((data) => {
|
|
||||||
if (r.ok) {
|
|
||||||
r.data = data;
|
|
||||||
} else {
|
|
||||||
r.error = data;
|
|
||||||
}
|
|
||||||
return r;
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
r.error = e;
|
|
||||||
return r;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (cancelToken) {
|
|
||||||
this.abortControllers.delete(cancelToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!response.ok) throw data;
|
|
||||||
return data;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @title cosmos/bank/v1beta1/authz.proto
|
|
||||||
* @version version not set
|
|
||||||
*/
|
|
||||||
export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
|
|
||||||
/**
|
|
||||||
* No description
|
|
||||||
*
|
|
||||||
* @tags Query
|
|
||||||
* @name QueryAllBalances
|
|
||||||
* @summary AllBalances queries the balance of all coins for a single account.
|
|
||||||
* @request GET:/cosmos/bank/v1beta1/balances/{address}
|
|
||||||
*/
|
|
||||||
queryAllBalances = (
|
|
||||||
address: string,
|
|
||||||
query?: {
|
|
||||||
"pagination.key"?: string;
|
|
||||||
"pagination.offset"?: string;
|
|
||||||
"pagination.limit"?: string;
|
|
||||||
"pagination.count_total"?: boolean;
|
|
||||||
"pagination.reverse"?: boolean;
|
|
||||||
},
|
|
||||||
params: RequestParams = {},
|
|
||||||
) =>
|
|
||||||
this.request<V1Beta1QueryAllBalancesResponse, RpcStatus>({
|
|
||||||
path: `/cosmos/bank/v1beta1/balances/${address}`,
|
|
||||||
method: "GET",
|
|
||||||
query: query,
|
|
||||||
format: "json",
|
|
||||||
...params,
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* No description
|
|
||||||
*
|
|
||||||
* @tags Query
|
|
||||||
* @name QueryBalance
|
|
||||||
* @summary Balance queries the balance of a single coin for a single account.
|
|
||||||
* @request GET:/cosmos/bank/v1beta1/balances/{address}/by_denom
|
|
||||||
*/
|
|
||||||
queryBalance = (address: string, query?: { denom?: string }, params: RequestParams = {}) =>
|
|
||||||
this.request<V1Beta1QueryBalanceResponse, RpcStatus>({
|
|
||||||
path: `/cosmos/bank/v1beta1/balances/${address}/by_denom`,
|
|
||||||
method: "GET",
|
|
||||||
query: query,
|
|
||||||
format: "json",
|
|
||||||
...params,
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* No description
|
|
||||||
*
|
|
||||||
* @tags Query
|
|
||||||
* @name QueryDenomsMetadata
|
|
||||||
* @summary DenomsMetadata queries the client metadata for all registered coin denominations.
|
|
||||||
* @request GET:/cosmos/bank/v1beta1/denoms_metadata
|
|
||||||
*/
|
|
||||||
queryDenomsMetadata = (
|
|
||||||
query?: {
|
|
||||||
"pagination.key"?: string;
|
|
||||||
"pagination.offset"?: string;
|
|
||||||
"pagination.limit"?: string;
|
|
||||||
"pagination.count_total"?: boolean;
|
|
||||||
"pagination.reverse"?: boolean;
|
|
||||||
},
|
|
||||||
params: RequestParams = {},
|
|
||||||
) =>
|
|
||||||
this.request<V1Beta1QueryDenomsMetadataResponse, RpcStatus>({
|
|
||||||
path: `/cosmos/bank/v1beta1/denoms_metadata`,
|
|
||||||
method: "GET",
|
|
||||||
query: query,
|
|
||||||
format: "json",
|
|
||||||
...params,
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* No description
|
|
||||||
*
|
|
||||||
* @tags Query
|
|
||||||
* @name QueryDenomMetadata
|
|
||||||
* @summary DenomsMetadata queries the client metadata of a given coin denomination.
|
|
||||||
* @request GET:/cosmos/bank/v1beta1/denoms_metadata/{denom}
|
|
||||||
*/
|
|
||||||
queryDenomMetadata = (denom: string, params: RequestParams = {}) =>
|
|
||||||
this.request<V1Beta1QueryDenomMetadataResponse, RpcStatus>({
|
|
||||||
path: `/cosmos/bank/v1beta1/denoms_metadata/${denom}`,
|
|
||||||
method: "GET",
|
|
||||||
format: "json",
|
|
||||||
...params,
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* No description
|
|
||||||
*
|
|
||||||
* @tags Query
|
|
||||||
* @name QueryParams
|
|
||||||
* @summary Params queries the parameters of x/bank module.
|
|
||||||
* @request GET:/cosmos/bank/v1beta1/params
|
|
||||||
*/
|
|
||||||
queryParams = (params: RequestParams = {}) =>
|
|
||||||
this.request<V1Beta1QueryParamsResponse, RpcStatus>({
|
|
||||||
path: `/cosmos/bank/v1beta1/params`,
|
|
||||||
method: "GET",
|
|
||||||
format: "json",
|
|
||||||
...params,
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* No description
|
|
||||||
*
|
|
||||||
* @tags Query
|
|
||||||
* @name QueryTotalSupply
|
|
||||||
* @summary TotalSupply queries the total supply of all coins.
|
|
||||||
* @request GET:/cosmos/bank/v1beta1/supply
|
|
||||||
*/
|
|
||||||
queryTotalSupply = (
|
|
||||||
query?: {
|
|
||||||
"pagination.key"?: string;
|
|
||||||
"pagination.offset"?: string;
|
|
||||||
"pagination.limit"?: string;
|
|
||||||
"pagination.count_total"?: boolean;
|
|
||||||
"pagination.reverse"?: boolean;
|
|
||||||
},
|
|
||||||
params: RequestParams = {},
|
|
||||||
) =>
|
|
||||||
this.request<V1Beta1QueryTotalSupplyResponse, RpcStatus>({
|
|
||||||
path: `/cosmos/bank/v1beta1/supply`,
|
|
||||||
method: "GET",
|
|
||||||
query: query,
|
|
||||||
format: "json",
|
|
||||||
...params,
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* No description
|
|
||||||
*
|
|
||||||
* @tags Query
|
|
||||||
* @name QuerySupplyOf
|
|
||||||
* @summary SupplyOf queries the supply of a single coin.
|
|
||||||
* @request GET:/cosmos/bank/v1beta1/supply/{denom}
|
|
||||||
*/
|
|
||||||
querySupplyOf = (denom: string, params: RequestParams = {}) =>
|
|
||||||
this.request<V1Beta1QuerySupplyOfResponse, RpcStatus>({
|
|
||||||
path: `/cosmos/bank/v1beta1/supply/${denom}`,
|
|
||||||
method: "GET",
|
|
||||||
format: "json",
|
|
||||||
...params,
|
|
||||||
});
|
|
||||||
}
|
|
|
@ -1,90 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import { Coin } from "../../../cosmos/base/v1beta1/coin";
|
|
||||||
import { Writer, Reader } from "protobufjs/minimal";
|
|
||||||
|
|
||||||
export const protobufPackage = "cosmos.bank.v1beta1";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SendAuthorization allows the grantee to spend up to spend_limit coins from
|
|
||||||
* the granter's account.
|
|
||||||
*
|
|
||||||
* Since: cosmos-sdk 0.43
|
|
||||||
*/
|
|
||||||
export interface SendAuthorization {
|
|
||||||
spend_limit: Coin[];
|
|
||||||
}
|
|
||||||
|
|
||||||
const baseSendAuthorization: object = {};
|
|
||||||
|
|
||||||
export const SendAuthorization = {
|
|
||||||
encode(message: SendAuthorization, writer: Writer = Writer.create()): Writer {
|
|
||||||
for (const v of message.spend_limit) {
|
|
||||||
Coin.encode(v!, writer.uint32(10).fork()).ldelim();
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): SendAuthorization {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseSendAuthorization } as SendAuthorization;
|
|
||||||
message.spend_limit = [];
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.spend_limit.push(Coin.decode(reader, reader.uint32()));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): SendAuthorization {
|
|
||||||
const message = { ...baseSendAuthorization } as SendAuthorization;
|
|
||||||
message.spend_limit = [];
|
|
||||||
if (object.spend_limit !== undefined && object.spend_limit !== null) {
|
|
||||||
for (const e of object.spend_limit) {
|
|
||||||
message.spend_limit.push(Coin.fromJSON(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: SendAuthorization): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
if (message.spend_limit) {
|
|
||||||
obj.spend_limit = message.spend_limit.map((e) =>
|
|
||||||
e ? Coin.toJSON(e) : undefined
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
obj.spend_limit = [];
|
|
||||||
}
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<SendAuthorization>): SendAuthorization {
|
|
||||||
const message = { ...baseSendAuthorization } as SendAuthorization;
|
|
||||||
message.spend_limit = [];
|
|
||||||
if (object.spend_limit !== undefined && object.spend_limit !== null) {
|
|
||||||
for (const e of object.spend_limit) {
|
|
||||||
message.spend_limit.push(Coin.fromPartial(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
||||||
export type DeepPartial<T> = T extends Builtin
|
|
||||||
? T
|
|
||||||
: T extends Array<infer U>
|
|
||||||
? Array<DeepPartial<U>>
|
|
||||||
: T extends ReadonlyArray<infer U>
|
|
||||||
? ReadonlyArray<DeepPartial<U>>
|
|
||||||
: T extends {}
|
|
||||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
||||||
: Partial<T>;
|
|
|
@ -1,737 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import { Coin } from "../../../cosmos/base/v1beta1/coin";
|
|
||||||
import { Writer, Reader } from "protobufjs/minimal";
|
|
||||||
|
|
||||||
export const protobufPackage = "cosmos.bank.v1beta1";
|
|
||||||
|
|
||||||
/** Params defines the parameters for the bank module. */
|
|
||||||
export interface Params {
|
|
||||||
send_enabled: SendEnabled[];
|
|
||||||
default_send_enabled: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SendEnabled maps coin denom to a send_enabled status (whether a denom is
|
|
||||||
* sendable).
|
|
||||||
*/
|
|
||||||
export interface SendEnabled {
|
|
||||||
denom: string;
|
|
||||||
enabled: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Input models transaction input. */
|
|
||||||
export interface Input {
|
|
||||||
address: string;
|
|
||||||
coins: Coin[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Output models transaction outputs. */
|
|
||||||
export interface Output {
|
|
||||||
address: string;
|
|
||||||
coins: Coin[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Supply represents a struct that passively keeps track of the total supply
|
|
||||||
* amounts in the network.
|
|
||||||
* This message is deprecated now that supply is indexed by denom.
|
|
||||||
*
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
export interface Supply {
|
|
||||||
total: Coin[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* DenomUnit represents a struct that describes a given
|
|
||||||
* denomination unit of the basic token.
|
|
||||||
*/
|
|
||||||
export interface DenomUnit {
|
|
||||||
/** denom represents the string name of the given denom unit (e.g uatom). */
|
|
||||||
denom: string;
|
|
||||||
/**
|
|
||||||
* exponent represents power of 10 exponent that one must
|
|
||||||
* raise the base_denom to in order to equal the given DenomUnit's denom
|
|
||||||
* 1 denom = 1^exponent base_denom
|
|
||||||
* (e.g. with a base_denom of uatom, one can create a DenomUnit of 'atom' with
|
|
||||||
* exponent = 6, thus: 1 atom = 10^6 uatom).
|
|
||||||
*/
|
|
||||||
exponent: number;
|
|
||||||
/** aliases is a list of string aliases for the given denom */
|
|
||||||
aliases: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Metadata represents a struct that describes
|
|
||||||
* a basic token.
|
|
||||||
*/
|
|
||||||
export interface Metadata {
|
|
||||||
description: string;
|
|
||||||
/** denom_units represents the list of DenomUnit's for a given coin */
|
|
||||||
denom_units: DenomUnit[];
|
|
||||||
/** base represents the base denom (should be the DenomUnit with exponent = 0). */
|
|
||||||
base: string;
|
|
||||||
/**
|
|
||||||
* display indicates the suggested denom that should be
|
|
||||||
* displayed in clients.
|
|
||||||
*/
|
|
||||||
display: string;
|
|
||||||
/**
|
|
||||||
* name defines the name of the token (eg: Cosmos Atom)
|
|
||||||
*
|
|
||||||
* Since: cosmos-sdk 0.43
|
|
||||||
*/
|
|
||||||
name: string;
|
|
||||||
/**
|
|
||||||
* symbol is the token symbol usually shown on exchanges (eg: ATOM). This can
|
|
||||||
* be the same as the display.
|
|
||||||
*
|
|
||||||
* Since: cosmos-sdk 0.43
|
|
||||||
*/
|
|
||||||
symbol: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
const baseParams: object = { default_send_enabled: false };
|
|
||||||
|
|
||||||
export const Params = {
|
|
||||||
encode(message: Params, writer: Writer = Writer.create()): Writer {
|
|
||||||
for (const v of message.send_enabled) {
|
|
||||||
SendEnabled.encode(v!, writer.uint32(10).fork()).ldelim();
|
|
||||||
}
|
|
||||||
if (message.default_send_enabled === true) {
|
|
||||||
writer.uint32(16).bool(message.default_send_enabled);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): Params {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseParams } as Params;
|
|
||||||
message.send_enabled = [];
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.send_enabled.push(
|
|
||||||
SendEnabled.decode(reader, reader.uint32())
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.default_send_enabled = reader.bool();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): Params {
|
|
||||||
const message = { ...baseParams } as Params;
|
|
||||||
message.send_enabled = [];
|
|
||||||
if (object.send_enabled !== undefined && object.send_enabled !== null) {
|
|
||||||
for (const e of object.send_enabled) {
|
|
||||||
message.send_enabled.push(SendEnabled.fromJSON(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.default_send_enabled !== undefined &&
|
|
||||||
object.default_send_enabled !== null
|
|
||||||
) {
|
|
||||||
message.default_send_enabled = Boolean(object.default_send_enabled);
|
|
||||||
} else {
|
|
||||||
message.default_send_enabled = false;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: Params): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
if (message.send_enabled) {
|
|
||||||
obj.send_enabled = message.send_enabled.map((e) =>
|
|
||||||
e ? SendEnabled.toJSON(e) : undefined
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
obj.send_enabled = [];
|
|
||||||
}
|
|
||||||
message.default_send_enabled !== undefined &&
|
|
||||||
(obj.default_send_enabled = message.default_send_enabled);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<Params>): Params {
|
|
||||||
const message = { ...baseParams } as Params;
|
|
||||||
message.send_enabled = [];
|
|
||||||
if (object.send_enabled !== undefined && object.send_enabled !== null) {
|
|
||||||
for (const e of object.send_enabled) {
|
|
||||||
message.send_enabled.push(SendEnabled.fromPartial(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.default_send_enabled !== undefined &&
|
|
||||||
object.default_send_enabled !== null
|
|
||||||
) {
|
|
||||||
message.default_send_enabled = object.default_send_enabled;
|
|
||||||
} else {
|
|
||||||
message.default_send_enabled = false;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseSendEnabled: object = { denom: "", enabled: false };
|
|
||||||
|
|
||||||
export const SendEnabled = {
|
|
||||||
encode(message: SendEnabled, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.denom !== "") {
|
|
||||||
writer.uint32(10).string(message.denom);
|
|
||||||
}
|
|
||||||
if (message.enabled === true) {
|
|
||||||
writer.uint32(16).bool(message.enabled);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): SendEnabled {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseSendEnabled } as SendEnabled;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.denom = reader.string();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.enabled = reader.bool();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): SendEnabled {
|
|
||||||
const message = { ...baseSendEnabled } as SendEnabled;
|
|
||||||
if (object.denom !== undefined && object.denom !== null) {
|
|
||||||
message.denom = String(object.denom);
|
|
||||||
} else {
|
|
||||||
message.denom = "";
|
|
||||||
}
|
|
||||||
if (object.enabled !== undefined && object.enabled !== null) {
|
|
||||||
message.enabled = Boolean(object.enabled);
|
|
||||||
} else {
|
|
||||||
message.enabled = false;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: SendEnabled): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.denom !== undefined && (obj.denom = message.denom);
|
|
||||||
message.enabled !== undefined && (obj.enabled = message.enabled);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<SendEnabled>): SendEnabled {
|
|
||||||
const message = { ...baseSendEnabled } as SendEnabled;
|
|
||||||
if (object.denom !== undefined && object.denom !== null) {
|
|
||||||
message.denom = object.denom;
|
|
||||||
} else {
|
|
||||||
message.denom = "";
|
|
||||||
}
|
|
||||||
if (object.enabled !== undefined && object.enabled !== null) {
|
|
||||||
message.enabled = object.enabled;
|
|
||||||
} else {
|
|
||||||
message.enabled = false;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseInput: object = { address: "" };
|
|
||||||
|
|
||||||
export const Input = {
|
|
||||||
encode(message: Input, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.address !== "") {
|
|
||||||
writer.uint32(10).string(message.address);
|
|
||||||
}
|
|
||||||
for (const v of message.coins) {
|
|
||||||
Coin.encode(v!, writer.uint32(18).fork()).ldelim();
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): Input {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseInput } as Input;
|
|
||||||
message.coins = [];
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.address = reader.string();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.coins.push(Coin.decode(reader, reader.uint32()));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): Input {
|
|
||||||
const message = { ...baseInput } as Input;
|
|
||||||
message.coins = [];
|
|
||||||
if (object.address !== undefined && object.address !== null) {
|
|
||||||
message.address = String(object.address);
|
|
||||||
} else {
|
|
||||||
message.address = "";
|
|
||||||
}
|
|
||||||
if (object.coins !== undefined && object.coins !== null) {
|
|
||||||
for (const e of object.coins) {
|
|
||||||
message.coins.push(Coin.fromJSON(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: Input): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.address !== undefined && (obj.address = message.address);
|
|
||||||
if (message.coins) {
|
|
||||||
obj.coins = message.coins.map((e) => (e ? Coin.toJSON(e) : undefined));
|
|
||||||
} else {
|
|
||||||
obj.coins = [];
|
|
||||||
}
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<Input>): Input {
|
|
||||||
const message = { ...baseInput } as Input;
|
|
||||||
message.coins = [];
|
|
||||||
if (object.address !== undefined && object.address !== null) {
|
|
||||||
message.address = object.address;
|
|
||||||
} else {
|
|
||||||
message.address = "";
|
|
||||||
}
|
|
||||||
if (object.coins !== undefined && object.coins !== null) {
|
|
||||||
for (const e of object.coins) {
|
|
||||||
message.coins.push(Coin.fromPartial(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseOutput: object = { address: "" };
|
|
||||||
|
|
||||||
export const Output = {
|
|
||||||
encode(message: Output, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.address !== "") {
|
|
||||||
writer.uint32(10).string(message.address);
|
|
||||||
}
|
|
||||||
for (const v of message.coins) {
|
|
||||||
Coin.encode(v!, writer.uint32(18).fork()).ldelim();
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): Output {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseOutput } as Output;
|
|
||||||
message.coins = [];
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.address = reader.string();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.coins.push(Coin.decode(reader, reader.uint32()));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): Output {
|
|
||||||
const message = { ...baseOutput } as Output;
|
|
||||||
message.coins = [];
|
|
||||||
if (object.address !== undefined && object.address !== null) {
|
|
||||||
message.address = String(object.address);
|
|
||||||
} else {
|
|
||||||
message.address = "";
|
|
||||||
}
|
|
||||||
if (object.coins !== undefined && object.coins !== null) {
|
|
||||||
for (const e of object.coins) {
|
|
||||||
message.coins.push(Coin.fromJSON(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: Output): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.address !== undefined && (obj.address = message.address);
|
|
||||||
if (message.coins) {
|
|
||||||
obj.coins = message.coins.map((e) => (e ? Coin.toJSON(e) : undefined));
|
|
||||||
} else {
|
|
||||||
obj.coins = [];
|
|
||||||
}
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<Output>): Output {
|
|
||||||
const message = { ...baseOutput } as Output;
|
|
||||||
message.coins = [];
|
|
||||||
if (object.address !== undefined && object.address !== null) {
|
|
||||||
message.address = object.address;
|
|
||||||
} else {
|
|
||||||
message.address = "";
|
|
||||||
}
|
|
||||||
if (object.coins !== undefined && object.coins !== null) {
|
|
||||||
for (const e of object.coins) {
|
|
||||||
message.coins.push(Coin.fromPartial(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseSupply: object = {};
|
|
||||||
|
|
||||||
export const Supply = {
|
|
||||||
encode(message: Supply, writer: Writer = Writer.create()): Writer {
|
|
||||||
for (const v of message.total) {
|
|
||||||
Coin.encode(v!, writer.uint32(10).fork()).ldelim();
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): Supply {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseSupply } as Supply;
|
|
||||||
message.total = [];
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.total.push(Coin.decode(reader, reader.uint32()));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): Supply {
|
|
||||||
const message = { ...baseSupply } as Supply;
|
|
||||||
message.total = [];
|
|
||||||
if (object.total !== undefined && object.total !== null) {
|
|
||||||
for (const e of object.total) {
|
|
||||||
message.total.push(Coin.fromJSON(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: Supply): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
if (message.total) {
|
|
||||||
obj.total = message.total.map((e) => (e ? Coin.toJSON(e) : undefined));
|
|
||||||
} else {
|
|
||||||
obj.total = [];
|
|
||||||
}
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<Supply>): Supply {
|
|
||||||
const message = { ...baseSupply } as Supply;
|
|
||||||
message.total = [];
|
|
||||||
if (object.total !== undefined && object.total !== null) {
|
|
||||||
for (const e of object.total) {
|
|
||||||
message.total.push(Coin.fromPartial(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseDenomUnit: object = { denom: "", exponent: 0, aliases: "" };
|
|
||||||
|
|
||||||
export const DenomUnit = {
|
|
||||||
encode(message: DenomUnit, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.denom !== "") {
|
|
||||||
writer.uint32(10).string(message.denom);
|
|
||||||
}
|
|
||||||
if (message.exponent !== 0) {
|
|
||||||
writer.uint32(16).uint32(message.exponent);
|
|
||||||
}
|
|
||||||
for (const v of message.aliases) {
|
|
||||||
writer.uint32(26).string(v!);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): DenomUnit {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseDenomUnit } as DenomUnit;
|
|
||||||
message.aliases = [];
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.denom = reader.string();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.exponent = reader.uint32();
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
message.aliases.push(reader.string());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): DenomUnit {
|
|
||||||
const message = { ...baseDenomUnit } as DenomUnit;
|
|
||||||
message.aliases = [];
|
|
||||||
if (object.denom !== undefined && object.denom !== null) {
|
|
||||||
message.denom = String(object.denom);
|
|
||||||
} else {
|
|
||||||
message.denom = "";
|
|
||||||
}
|
|
||||||
if (object.exponent !== undefined && object.exponent !== null) {
|
|
||||||
message.exponent = Number(object.exponent);
|
|
||||||
} else {
|
|
||||||
message.exponent = 0;
|
|
||||||
}
|
|
||||||
if (object.aliases !== undefined && object.aliases !== null) {
|
|
||||||
for (const e of object.aliases) {
|
|
||||||
message.aliases.push(String(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: DenomUnit): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.denom !== undefined && (obj.denom = message.denom);
|
|
||||||
message.exponent !== undefined && (obj.exponent = message.exponent);
|
|
||||||
if (message.aliases) {
|
|
||||||
obj.aliases = message.aliases.map((e) => e);
|
|
||||||
} else {
|
|
||||||
obj.aliases = [];
|
|
||||||
}
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<DenomUnit>): DenomUnit {
|
|
||||||
const message = { ...baseDenomUnit } as DenomUnit;
|
|
||||||
message.aliases = [];
|
|
||||||
if (object.denom !== undefined && object.denom !== null) {
|
|
||||||
message.denom = object.denom;
|
|
||||||
} else {
|
|
||||||
message.denom = "";
|
|
||||||
}
|
|
||||||
if (object.exponent !== undefined && object.exponent !== null) {
|
|
||||||
message.exponent = object.exponent;
|
|
||||||
} else {
|
|
||||||
message.exponent = 0;
|
|
||||||
}
|
|
||||||
if (object.aliases !== undefined && object.aliases !== null) {
|
|
||||||
for (const e of object.aliases) {
|
|
||||||
message.aliases.push(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseMetadata: object = {
|
|
||||||
description: "",
|
|
||||||
base: "",
|
|
||||||
display: "",
|
|
||||||
name: "",
|
|
||||||
symbol: "",
|
|
||||||
};
|
|
||||||
|
|
||||||
export const Metadata = {
|
|
||||||
encode(message: Metadata, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.description !== "") {
|
|
||||||
writer.uint32(10).string(message.description);
|
|
||||||
}
|
|
||||||
for (const v of message.denom_units) {
|
|
||||||
DenomUnit.encode(v!, writer.uint32(18).fork()).ldelim();
|
|
||||||
}
|
|
||||||
if (message.base !== "") {
|
|
||||||
writer.uint32(26).string(message.base);
|
|
||||||
}
|
|
||||||
if (message.display !== "") {
|
|
||||||
writer.uint32(34).string(message.display);
|
|
||||||
}
|
|
||||||
if (message.name !== "") {
|
|
||||||
writer.uint32(42).string(message.name);
|
|
||||||
}
|
|
||||||
if (message.symbol !== "") {
|
|
||||||
writer.uint32(50).string(message.symbol);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): Metadata {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseMetadata } as Metadata;
|
|
||||||
message.denom_units = [];
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.description = reader.string();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.denom_units.push(DenomUnit.decode(reader, reader.uint32()));
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
message.base = reader.string();
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
message.display = reader.string();
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
message.name = reader.string();
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
message.symbol = reader.string();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): Metadata {
|
|
||||||
const message = { ...baseMetadata } as Metadata;
|
|
||||||
message.denom_units = [];
|
|
||||||
if (object.description !== undefined && object.description !== null) {
|
|
||||||
message.description = String(object.description);
|
|
||||||
} else {
|
|
||||||
message.description = "";
|
|
||||||
}
|
|
||||||
if (object.denom_units !== undefined && object.denom_units !== null) {
|
|
||||||
for (const e of object.denom_units) {
|
|
||||||
message.denom_units.push(DenomUnit.fromJSON(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (object.base !== undefined && object.base !== null) {
|
|
||||||
message.base = String(object.base);
|
|
||||||
} else {
|
|
||||||
message.base = "";
|
|
||||||
}
|
|
||||||
if (object.display !== undefined && object.display !== null) {
|
|
||||||
message.display = String(object.display);
|
|
||||||
} else {
|
|
||||||
message.display = "";
|
|
||||||
}
|
|
||||||
if (object.name !== undefined && object.name !== null) {
|
|
||||||
message.name = String(object.name);
|
|
||||||
} else {
|
|
||||||
message.name = "";
|
|
||||||
}
|
|
||||||
if (object.symbol !== undefined && object.symbol !== null) {
|
|
||||||
message.symbol = String(object.symbol);
|
|
||||||
} else {
|
|
||||||
message.symbol = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: Metadata): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.description !== undefined &&
|
|
||||||
(obj.description = message.description);
|
|
||||||
if (message.denom_units) {
|
|
||||||
obj.denom_units = message.denom_units.map((e) =>
|
|
||||||
e ? DenomUnit.toJSON(e) : undefined
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
obj.denom_units = [];
|
|
||||||
}
|
|
||||||
message.base !== undefined && (obj.base = message.base);
|
|
||||||
message.display !== undefined && (obj.display = message.display);
|
|
||||||
message.name !== undefined && (obj.name = message.name);
|
|
||||||
message.symbol !== undefined && (obj.symbol = message.symbol);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<Metadata>): Metadata {
|
|
||||||
const message = { ...baseMetadata } as Metadata;
|
|
||||||
message.denom_units = [];
|
|
||||||
if (object.description !== undefined && object.description !== null) {
|
|
||||||
message.description = object.description;
|
|
||||||
} else {
|
|
||||||
message.description = "";
|
|
||||||
}
|
|
||||||
if (object.denom_units !== undefined && object.denom_units !== null) {
|
|
||||||
for (const e of object.denom_units) {
|
|
||||||
message.denom_units.push(DenomUnit.fromPartial(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (object.base !== undefined && object.base !== null) {
|
|
||||||
message.base = object.base;
|
|
||||||
} else {
|
|
||||||
message.base = "";
|
|
||||||
}
|
|
||||||
if (object.display !== undefined && object.display !== null) {
|
|
||||||
message.display = object.display;
|
|
||||||
} else {
|
|
||||||
message.display = "";
|
|
||||||
}
|
|
||||||
if (object.name !== undefined && object.name !== null) {
|
|
||||||
message.name = object.name;
|
|
||||||
} else {
|
|
||||||
message.name = "";
|
|
||||||
}
|
|
||||||
if (object.symbol !== undefined && object.symbol !== null) {
|
|
||||||
message.symbol = object.symbol;
|
|
||||||
} else {
|
|
||||||
message.symbol = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
||||||
export type DeepPartial<T> = T extends Builtin
|
|
||||||
? T
|
|
||||||
: T extends Array<infer U>
|
|
||||||
? Array<DeepPartial<U>>
|
|
||||||
: T extends ReadonlyArray<infer U>
|
|
||||||
? ReadonlyArray<DeepPartial<U>>
|
|
||||||
: T extends {}
|
|
||||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
||||||
: Partial<T>;
|
|
|
@ -1,254 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import { Params, Metadata } from "../../../cosmos/bank/v1beta1/bank";
|
|
||||||
import { Coin } from "../../../cosmos/base/v1beta1/coin";
|
|
||||||
import { Writer, Reader } from "protobufjs/minimal";
|
|
||||||
|
|
||||||
export const protobufPackage = "cosmos.bank.v1beta1";
|
|
||||||
|
|
||||||
/** GenesisState defines the bank module's genesis state. */
|
|
||||||
export interface GenesisState {
|
|
||||||
/** params defines all the paramaters of the module. */
|
|
||||||
params: Params | undefined;
|
|
||||||
/** balances is an array containing the balances of all the accounts. */
|
|
||||||
balances: Balance[];
|
|
||||||
/**
|
|
||||||
* supply represents the total supply. If it is left empty, then supply will be calculated based on the provided
|
|
||||||
* balances. Otherwise, it will be used to validate that the sum of the balances equals this amount.
|
|
||||||
*/
|
|
||||||
supply: Coin[];
|
|
||||||
/** denom_metadata defines the metadata of the differents coins. */
|
|
||||||
denom_metadata: Metadata[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Balance defines an account address and balance pair used in the bank module's
|
|
||||||
* genesis state.
|
|
||||||
*/
|
|
||||||
export interface Balance {
|
|
||||||
/** address is the address of the balance holder. */
|
|
||||||
address: string;
|
|
||||||
/** coins defines the different coins this balance holds. */
|
|
||||||
coins: Coin[];
|
|
||||||
}
|
|
||||||
|
|
||||||
const baseGenesisState: object = {};
|
|
||||||
|
|
||||||
export const GenesisState = {
|
|
||||||
encode(message: GenesisState, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.params !== undefined) {
|
|
||||||
Params.encode(message.params, writer.uint32(10).fork()).ldelim();
|
|
||||||
}
|
|
||||||
for (const v of message.balances) {
|
|
||||||
Balance.encode(v!, writer.uint32(18).fork()).ldelim();
|
|
||||||
}
|
|
||||||
for (const v of message.supply) {
|
|
||||||
Coin.encode(v!, writer.uint32(26).fork()).ldelim();
|
|
||||||
}
|
|
||||||
for (const v of message.denom_metadata) {
|
|
||||||
Metadata.encode(v!, writer.uint32(34).fork()).ldelim();
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): GenesisState {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseGenesisState } as GenesisState;
|
|
||||||
message.balances = [];
|
|
||||||
message.supply = [];
|
|
||||||
message.denom_metadata = [];
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.params = Params.decode(reader, reader.uint32());
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.balances.push(Balance.decode(reader, reader.uint32()));
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
message.supply.push(Coin.decode(reader, reader.uint32()));
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
message.denom_metadata.push(Metadata.decode(reader, reader.uint32()));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): GenesisState {
|
|
||||||
const message = { ...baseGenesisState } as GenesisState;
|
|
||||||
message.balances = [];
|
|
||||||
message.supply = [];
|
|
||||||
message.denom_metadata = [];
|
|
||||||
if (object.params !== undefined && object.params !== null) {
|
|
||||||
message.params = Params.fromJSON(object.params);
|
|
||||||
} else {
|
|
||||||
message.params = undefined;
|
|
||||||
}
|
|
||||||
if (object.balances !== undefined && object.balances !== null) {
|
|
||||||
for (const e of object.balances) {
|
|
||||||
message.balances.push(Balance.fromJSON(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (object.supply !== undefined && object.supply !== null) {
|
|
||||||
for (const e of object.supply) {
|
|
||||||
message.supply.push(Coin.fromJSON(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (object.denom_metadata !== undefined && object.denom_metadata !== null) {
|
|
||||||
for (const e of object.denom_metadata) {
|
|
||||||
message.denom_metadata.push(Metadata.fromJSON(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: GenesisState): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.params !== undefined &&
|
|
||||||
(obj.params = message.params ? Params.toJSON(message.params) : undefined);
|
|
||||||
if (message.balances) {
|
|
||||||
obj.balances = message.balances.map((e) =>
|
|
||||||
e ? Balance.toJSON(e) : undefined
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
obj.balances = [];
|
|
||||||
}
|
|
||||||
if (message.supply) {
|
|
||||||
obj.supply = message.supply.map((e) => (e ? Coin.toJSON(e) : undefined));
|
|
||||||
} else {
|
|
||||||
obj.supply = [];
|
|
||||||
}
|
|
||||||
if (message.denom_metadata) {
|
|
||||||
obj.denom_metadata = message.denom_metadata.map((e) =>
|
|
||||||
e ? Metadata.toJSON(e) : undefined
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
obj.denom_metadata = [];
|
|
||||||
}
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<GenesisState>): GenesisState {
|
|
||||||
const message = { ...baseGenesisState } as GenesisState;
|
|
||||||
message.balances = [];
|
|
||||||
message.supply = [];
|
|
||||||
message.denom_metadata = [];
|
|
||||||
if (object.params !== undefined && object.params !== null) {
|
|
||||||
message.params = Params.fromPartial(object.params);
|
|
||||||
} else {
|
|
||||||
message.params = undefined;
|
|
||||||
}
|
|
||||||
if (object.balances !== undefined && object.balances !== null) {
|
|
||||||
for (const e of object.balances) {
|
|
||||||
message.balances.push(Balance.fromPartial(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (object.supply !== undefined && object.supply !== null) {
|
|
||||||
for (const e of object.supply) {
|
|
||||||
message.supply.push(Coin.fromPartial(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (object.denom_metadata !== undefined && object.denom_metadata !== null) {
|
|
||||||
for (const e of object.denom_metadata) {
|
|
||||||
message.denom_metadata.push(Metadata.fromPartial(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseBalance: object = { address: "" };
|
|
||||||
|
|
||||||
export const Balance = {
|
|
||||||
encode(message: Balance, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.address !== "") {
|
|
||||||
writer.uint32(10).string(message.address);
|
|
||||||
}
|
|
||||||
for (const v of message.coins) {
|
|
||||||
Coin.encode(v!, writer.uint32(18).fork()).ldelim();
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): Balance {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseBalance } as Balance;
|
|
||||||
message.coins = [];
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.address = reader.string();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.coins.push(Coin.decode(reader, reader.uint32()));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): Balance {
|
|
||||||
const message = { ...baseBalance } as Balance;
|
|
||||||
message.coins = [];
|
|
||||||
if (object.address !== undefined && object.address !== null) {
|
|
||||||
message.address = String(object.address);
|
|
||||||
} else {
|
|
||||||
message.address = "";
|
|
||||||
}
|
|
||||||
if (object.coins !== undefined && object.coins !== null) {
|
|
||||||
for (const e of object.coins) {
|
|
||||||
message.coins.push(Coin.fromJSON(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: Balance): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.address !== undefined && (obj.address = message.address);
|
|
||||||
if (message.coins) {
|
|
||||||
obj.coins = message.coins.map((e) => (e ? Coin.toJSON(e) : undefined));
|
|
||||||
} else {
|
|
||||||
obj.coins = [];
|
|
||||||
}
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<Balance>): Balance {
|
|
||||||
const message = { ...baseBalance } as Balance;
|
|
||||||
message.coins = [];
|
|
||||||
if (object.address !== undefined && object.address !== null) {
|
|
||||||
message.address = object.address;
|
|
||||||
} else {
|
|
||||||
message.address = "";
|
|
||||||
}
|
|
||||||
if (object.coins !== undefined && object.coins !== null) {
|
|
||||||
for (const e of object.coins) {
|
|
||||||
message.coins.push(Coin.fromPartial(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
||||||
export type DeepPartial<T> = T extends Builtin
|
|
||||||
? T
|
|
||||||
: T extends Array<infer U>
|
|
||||||
? Array<DeepPartial<U>>
|
|
||||||
: T extends ReadonlyArray<infer U>
|
|
||||||
? ReadonlyArray<DeepPartial<U>>
|
|
||||||
: T extends {}
|
|
||||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
||||||
: Partial<T>;
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,337 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import { Reader, Writer } from "protobufjs/minimal";
|
|
||||||
import { Coin } from "../../../cosmos/base/v1beta1/coin";
|
|
||||||
import { Input, Output } from "../../../cosmos/bank/v1beta1/bank";
|
|
||||||
|
|
||||||
export const protobufPackage = "cosmos.bank.v1beta1";
|
|
||||||
|
|
||||||
/** MsgSend represents a message to send coins from one account to another. */
|
|
||||||
export interface MsgSend {
|
|
||||||
from_address: string;
|
|
||||||
to_address: string;
|
|
||||||
amount: Coin[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** MsgSendResponse defines the Msg/Send response type. */
|
|
||||||
export interface MsgSendResponse {}
|
|
||||||
|
|
||||||
/** MsgMultiSend represents an arbitrary multi-in, multi-out send message. */
|
|
||||||
export interface MsgMultiSend {
|
|
||||||
inputs: Input[];
|
|
||||||
outputs: Output[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** MsgMultiSendResponse defines the Msg/MultiSend response type. */
|
|
||||||
export interface MsgMultiSendResponse {}
|
|
||||||
|
|
||||||
const baseMsgSend: object = { from_address: "", to_address: "" };
|
|
||||||
|
|
||||||
export const MsgSend = {
|
|
||||||
encode(message: MsgSend, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.from_address !== "") {
|
|
||||||
writer.uint32(10).string(message.from_address);
|
|
||||||
}
|
|
||||||
if (message.to_address !== "") {
|
|
||||||
writer.uint32(18).string(message.to_address);
|
|
||||||
}
|
|
||||||
for (const v of message.amount) {
|
|
||||||
Coin.encode(v!, writer.uint32(26).fork()).ldelim();
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): MsgSend {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseMsgSend } as MsgSend;
|
|
||||||
message.amount = [];
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.from_address = reader.string();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.to_address = reader.string();
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
message.amount.push(Coin.decode(reader, reader.uint32()));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): MsgSend {
|
|
||||||
const message = { ...baseMsgSend } as MsgSend;
|
|
||||||
message.amount = [];
|
|
||||||
if (object.from_address !== undefined && object.from_address !== null) {
|
|
||||||
message.from_address = String(object.from_address);
|
|
||||||
} else {
|
|
||||||
message.from_address = "";
|
|
||||||
}
|
|
||||||
if (object.to_address !== undefined && object.to_address !== null) {
|
|
||||||
message.to_address = String(object.to_address);
|
|
||||||
} else {
|
|
||||||
message.to_address = "";
|
|
||||||
}
|
|
||||||
if (object.amount !== undefined && object.amount !== null) {
|
|
||||||
for (const e of object.amount) {
|
|
||||||
message.amount.push(Coin.fromJSON(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: MsgSend): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.from_address !== undefined &&
|
|
||||||
(obj.from_address = message.from_address);
|
|
||||||
message.to_address !== undefined && (obj.to_address = message.to_address);
|
|
||||||
if (message.amount) {
|
|
||||||
obj.amount = message.amount.map((e) => (e ? Coin.toJSON(e) : undefined));
|
|
||||||
} else {
|
|
||||||
obj.amount = [];
|
|
||||||
}
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<MsgSend>): MsgSend {
|
|
||||||
const message = { ...baseMsgSend } as MsgSend;
|
|
||||||
message.amount = [];
|
|
||||||
if (object.from_address !== undefined && object.from_address !== null) {
|
|
||||||
message.from_address = object.from_address;
|
|
||||||
} else {
|
|
||||||
message.from_address = "";
|
|
||||||
}
|
|
||||||
if (object.to_address !== undefined && object.to_address !== null) {
|
|
||||||
message.to_address = object.to_address;
|
|
||||||
} else {
|
|
||||||
message.to_address = "";
|
|
||||||
}
|
|
||||||
if (object.amount !== undefined && object.amount !== null) {
|
|
||||||
for (const e of object.amount) {
|
|
||||||
message.amount.push(Coin.fromPartial(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseMsgSendResponse: object = {};
|
|
||||||
|
|
||||||
export const MsgSendResponse = {
|
|
||||||
encode(_: MsgSendResponse, writer: Writer = Writer.create()): Writer {
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): MsgSendResponse {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseMsgSendResponse } as MsgSendResponse;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(_: any): MsgSendResponse {
|
|
||||||
const message = { ...baseMsgSendResponse } as MsgSendResponse;
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(_: MsgSendResponse): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(_: DeepPartial<MsgSendResponse>): MsgSendResponse {
|
|
||||||
const message = { ...baseMsgSendResponse } as MsgSendResponse;
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseMsgMultiSend: object = {};
|
|
||||||
|
|
||||||
export const MsgMultiSend = {
|
|
||||||
encode(message: MsgMultiSend, writer: Writer = Writer.create()): Writer {
|
|
||||||
for (const v of message.inputs) {
|
|
||||||
Input.encode(v!, writer.uint32(10).fork()).ldelim();
|
|
||||||
}
|
|
||||||
for (const v of message.outputs) {
|
|
||||||
Output.encode(v!, writer.uint32(18).fork()).ldelim();
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): MsgMultiSend {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseMsgMultiSend } as MsgMultiSend;
|
|
||||||
message.inputs = [];
|
|
||||||
message.outputs = [];
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.inputs.push(Input.decode(reader, reader.uint32()));
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.outputs.push(Output.decode(reader, reader.uint32()));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): MsgMultiSend {
|
|
||||||
const message = { ...baseMsgMultiSend } as MsgMultiSend;
|
|
||||||
message.inputs = [];
|
|
||||||
message.outputs = [];
|
|
||||||
if (object.inputs !== undefined && object.inputs !== null) {
|
|
||||||
for (const e of object.inputs) {
|
|
||||||
message.inputs.push(Input.fromJSON(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (object.outputs !== undefined && object.outputs !== null) {
|
|
||||||
for (const e of object.outputs) {
|
|
||||||
message.outputs.push(Output.fromJSON(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: MsgMultiSend): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
if (message.inputs) {
|
|
||||||
obj.inputs = message.inputs.map((e) => (e ? Input.toJSON(e) : undefined));
|
|
||||||
} else {
|
|
||||||
obj.inputs = [];
|
|
||||||
}
|
|
||||||
if (message.outputs) {
|
|
||||||
obj.outputs = message.outputs.map((e) =>
|
|
||||||
e ? Output.toJSON(e) : undefined
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
obj.outputs = [];
|
|
||||||
}
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<MsgMultiSend>): MsgMultiSend {
|
|
||||||
const message = { ...baseMsgMultiSend } as MsgMultiSend;
|
|
||||||
message.inputs = [];
|
|
||||||
message.outputs = [];
|
|
||||||
if (object.inputs !== undefined && object.inputs !== null) {
|
|
||||||
for (const e of object.inputs) {
|
|
||||||
message.inputs.push(Input.fromPartial(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (object.outputs !== undefined && object.outputs !== null) {
|
|
||||||
for (const e of object.outputs) {
|
|
||||||
message.outputs.push(Output.fromPartial(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseMsgMultiSendResponse: object = {};
|
|
||||||
|
|
||||||
export const MsgMultiSendResponse = {
|
|
||||||
encode(_: MsgMultiSendResponse, writer: Writer = Writer.create()): Writer {
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): MsgMultiSendResponse {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseMsgMultiSendResponse } as MsgMultiSendResponse;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(_: any): MsgMultiSendResponse {
|
|
||||||
const message = { ...baseMsgMultiSendResponse } as MsgMultiSendResponse;
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(_: MsgMultiSendResponse): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(_: DeepPartial<MsgMultiSendResponse>): MsgMultiSendResponse {
|
|
||||||
const message = { ...baseMsgMultiSendResponse } as MsgMultiSendResponse;
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
/** Msg defines the bank Msg service. */
|
|
||||||
export interface Msg {
|
|
||||||
/** Send defines a method for sending coins from one account to another account. */
|
|
||||||
Send(request: MsgSend): Promise<MsgSendResponse>;
|
|
||||||
/** MultiSend defines a method for sending coins from some accounts to other accounts. */
|
|
||||||
MultiSend(request: MsgMultiSend): Promise<MsgMultiSendResponse>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class MsgClientImpl implements Msg {
|
|
||||||
private readonly rpc: Rpc;
|
|
||||||
constructor(rpc: Rpc) {
|
|
||||||
this.rpc = rpc;
|
|
||||||
}
|
|
||||||
Send(request: MsgSend): Promise<MsgSendResponse> {
|
|
||||||
const data = MsgSend.encode(request).finish();
|
|
||||||
const promise = this.rpc.request("cosmos.bank.v1beta1.Msg", "Send", data);
|
|
||||||
return promise.then((data) => MsgSendResponse.decode(new Reader(data)));
|
|
||||||
}
|
|
||||||
|
|
||||||
MultiSend(request: MsgMultiSend): Promise<MsgMultiSendResponse> {
|
|
||||||
const data = MsgMultiSend.encode(request).finish();
|
|
||||||
const promise = this.rpc.request(
|
|
||||||
"cosmos.bank.v1beta1.Msg",
|
|
||||||
"MultiSend",
|
|
||||||
data
|
|
||||||
);
|
|
||||||
return promise.then((data) =>
|
|
||||||
MsgMultiSendResponse.decode(new Reader(data))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Rpc {
|
|
||||||
request(
|
|
||||||
service: string,
|
|
||||||
method: string,
|
|
||||||
data: Uint8Array
|
|
||||||
): Promise<Uint8Array>;
|
|
||||||
}
|
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
||||||
export type DeepPartial<T> = T extends Builtin
|
|
||||||
? T
|
|
||||||
: T extends Array<infer U>
|
|
||||||
? Array<DeepPartial<U>>
|
|
||||||
: T extends ReadonlyArray<infer U>
|
|
||||||
? ReadonlyArray<DeepPartial<U>>
|
|
||||||
: T extends {}
|
|
||||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
||||||
: Partial<T>;
|
|
|
@ -1,328 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import * as Long from "long";
|
|
||||||
import { util, configure, Writer, Reader } from "protobufjs/minimal";
|
|
||||||
|
|
||||||
export const protobufPackage = "cosmos.base.query.v1beta1";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PageRequest is to be embedded in gRPC request messages for efficient
|
|
||||||
* pagination. Ex:
|
|
||||||
*
|
|
||||||
* message SomeRequest {
|
|
||||||
* Foo some_parameter = 1;
|
|
||||||
* PageRequest pagination = 2;
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
export interface PageRequest {
|
|
||||||
/**
|
|
||||||
* key is a value returned in PageResponse.next_key to begin
|
|
||||||
* querying the next page most efficiently. Only one of offset or key
|
|
||||||
* should be set.
|
|
||||||
*/
|
|
||||||
key: Uint8Array;
|
|
||||||
/**
|
|
||||||
* offset is a numeric offset that can be used when key is unavailable.
|
|
||||||
* It is less efficient than using key. Only one of offset or key should
|
|
||||||
* be set.
|
|
||||||
*/
|
|
||||||
offset: number;
|
|
||||||
/**
|
|
||||||
* limit is the total number of results to be returned in the result page.
|
|
||||||
* If left empty it will default to a value to be set by each app.
|
|
||||||
*/
|
|
||||||
limit: number;
|
|
||||||
/**
|
|
||||||
* count_total is set to true to indicate that the result set should include
|
|
||||||
* a count of the total number of items available for pagination in UIs.
|
|
||||||
* count_total is only respected when offset is used. It is ignored when key
|
|
||||||
* is set.
|
|
||||||
*/
|
|
||||||
count_total: boolean;
|
|
||||||
/**
|
|
||||||
* reverse is set to true if results are to be returned in the descending order.
|
|
||||||
*
|
|
||||||
* Since: cosmos-sdk 0.43
|
|
||||||
*/
|
|
||||||
reverse: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PageResponse is to be embedded in gRPC response messages where the
|
|
||||||
* corresponding request message has used PageRequest.
|
|
||||||
*
|
|
||||||
* message SomeResponse {
|
|
||||||
* repeated Bar results = 1;
|
|
||||||
* PageResponse page = 2;
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
export interface PageResponse {
|
|
||||||
/**
|
|
||||||
* next_key is the key to be passed to PageRequest.key to
|
|
||||||
* query the next page most efficiently
|
|
||||||
*/
|
|
||||||
next_key: Uint8Array;
|
|
||||||
/**
|
|
||||||
* total is total number of results available if PageRequest.count_total
|
|
||||||
* was set, its value is undefined otherwise
|
|
||||||
*/
|
|
||||||
total: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
const basePageRequest: object = {
|
|
||||||
offset: 0,
|
|
||||||
limit: 0,
|
|
||||||
count_total: false,
|
|
||||||
reverse: false,
|
|
||||||
};
|
|
||||||
|
|
||||||
export const PageRequest = {
|
|
||||||
encode(message: PageRequest, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.key.length !== 0) {
|
|
||||||
writer.uint32(10).bytes(message.key);
|
|
||||||
}
|
|
||||||
if (message.offset !== 0) {
|
|
||||||
writer.uint32(16).uint64(message.offset);
|
|
||||||
}
|
|
||||||
if (message.limit !== 0) {
|
|
||||||
writer.uint32(24).uint64(message.limit);
|
|
||||||
}
|
|
||||||
if (message.count_total === true) {
|
|
||||||
writer.uint32(32).bool(message.count_total);
|
|
||||||
}
|
|
||||||
if (message.reverse === true) {
|
|
||||||
writer.uint32(40).bool(message.reverse);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): PageRequest {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...basePageRequest } as PageRequest;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.key = reader.bytes();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.offset = longToNumber(reader.uint64() as Long);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
message.limit = longToNumber(reader.uint64() as Long);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
message.count_total = reader.bool();
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
message.reverse = reader.bool();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): PageRequest {
|
|
||||||
const message = { ...basePageRequest } as PageRequest;
|
|
||||||
if (object.key !== undefined && object.key !== null) {
|
|
||||||
message.key = bytesFromBase64(object.key);
|
|
||||||
}
|
|
||||||
if (object.offset !== undefined && object.offset !== null) {
|
|
||||||
message.offset = Number(object.offset);
|
|
||||||
} else {
|
|
||||||
message.offset = 0;
|
|
||||||
}
|
|
||||||
if (object.limit !== undefined && object.limit !== null) {
|
|
||||||
message.limit = Number(object.limit);
|
|
||||||
} else {
|
|
||||||
message.limit = 0;
|
|
||||||
}
|
|
||||||
if (object.count_total !== undefined && object.count_total !== null) {
|
|
||||||
message.count_total = Boolean(object.count_total);
|
|
||||||
} else {
|
|
||||||
message.count_total = false;
|
|
||||||
}
|
|
||||||
if (object.reverse !== undefined && object.reverse !== null) {
|
|
||||||
message.reverse = Boolean(object.reverse);
|
|
||||||
} else {
|
|
||||||
message.reverse = false;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: PageRequest): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.key !== undefined &&
|
|
||||||
(obj.key = base64FromBytes(
|
|
||||||
message.key !== undefined ? message.key : new Uint8Array()
|
|
||||||
));
|
|
||||||
message.offset !== undefined && (obj.offset = message.offset);
|
|
||||||
message.limit !== undefined && (obj.limit = message.limit);
|
|
||||||
message.count_total !== undefined &&
|
|
||||||
(obj.count_total = message.count_total);
|
|
||||||
message.reverse !== undefined && (obj.reverse = message.reverse);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<PageRequest>): PageRequest {
|
|
||||||
const message = { ...basePageRequest } as PageRequest;
|
|
||||||
if (object.key !== undefined && object.key !== null) {
|
|
||||||
message.key = object.key;
|
|
||||||
} else {
|
|
||||||
message.key = new Uint8Array();
|
|
||||||
}
|
|
||||||
if (object.offset !== undefined && object.offset !== null) {
|
|
||||||
message.offset = object.offset;
|
|
||||||
} else {
|
|
||||||
message.offset = 0;
|
|
||||||
}
|
|
||||||
if (object.limit !== undefined && object.limit !== null) {
|
|
||||||
message.limit = object.limit;
|
|
||||||
} else {
|
|
||||||
message.limit = 0;
|
|
||||||
}
|
|
||||||
if (object.count_total !== undefined && object.count_total !== null) {
|
|
||||||
message.count_total = object.count_total;
|
|
||||||
} else {
|
|
||||||
message.count_total = false;
|
|
||||||
}
|
|
||||||
if (object.reverse !== undefined && object.reverse !== null) {
|
|
||||||
message.reverse = object.reverse;
|
|
||||||
} else {
|
|
||||||
message.reverse = false;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const basePageResponse: object = { total: 0 };
|
|
||||||
|
|
||||||
export const PageResponse = {
|
|
||||||
encode(message: PageResponse, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.next_key.length !== 0) {
|
|
||||||
writer.uint32(10).bytes(message.next_key);
|
|
||||||
}
|
|
||||||
if (message.total !== 0) {
|
|
||||||
writer.uint32(16).uint64(message.total);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): PageResponse {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...basePageResponse } as PageResponse;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.next_key = reader.bytes();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.total = longToNumber(reader.uint64() as Long);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): PageResponse {
|
|
||||||
const message = { ...basePageResponse } as PageResponse;
|
|
||||||
if (object.next_key !== undefined && object.next_key !== null) {
|
|
||||||
message.next_key = bytesFromBase64(object.next_key);
|
|
||||||
}
|
|
||||||
if (object.total !== undefined && object.total !== null) {
|
|
||||||
message.total = Number(object.total);
|
|
||||||
} else {
|
|
||||||
message.total = 0;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: PageResponse): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.next_key !== undefined &&
|
|
||||||
(obj.next_key = base64FromBytes(
|
|
||||||
message.next_key !== undefined ? message.next_key : new Uint8Array()
|
|
||||||
));
|
|
||||||
message.total !== undefined && (obj.total = message.total);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<PageResponse>): PageResponse {
|
|
||||||
const message = { ...basePageResponse } as PageResponse;
|
|
||||||
if (object.next_key !== undefined && object.next_key !== null) {
|
|
||||||
message.next_key = object.next_key;
|
|
||||||
} else {
|
|
||||||
message.next_key = new Uint8Array();
|
|
||||||
}
|
|
||||||
if (object.total !== undefined && object.total !== null) {
|
|
||||||
message.total = object.total;
|
|
||||||
} else {
|
|
||||||
message.total = 0;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
declare var self: any | undefined;
|
|
||||||
declare var window: any | undefined;
|
|
||||||
var globalThis: any = (() => {
|
|
||||||
if (typeof globalThis !== "undefined") return globalThis;
|
|
||||||
if (typeof self !== "undefined") return self;
|
|
||||||
if (typeof window !== "undefined") return window;
|
|
||||||
if (typeof global !== "undefined") return global;
|
|
||||||
throw "Unable to locate global object";
|
|
||||||
})();
|
|
||||||
|
|
||||||
const atob: (b64: string) => string =
|
|
||||||
globalThis.atob ||
|
|
||||||
((b64) => globalThis.Buffer.from(b64, "base64").toString("binary"));
|
|
||||||
function bytesFromBase64(b64: string): Uint8Array {
|
|
||||||
const bin = atob(b64);
|
|
||||||
const arr = new Uint8Array(bin.length);
|
|
||||||
for (let i = 0; i < bin.length; ++i) {
|
|
||||||
arr[i] = bin.charCodeAt(i);
|
|
||||||
}
|
|
||||||
return arr;
|
|
||||||
}
|
|
||||||
|
|
||||||
const btoa: (bin: string) => string =
|
|
||||||
globalThis.btoa ||
|
|
||||||
((bin) => globalThis.Buffer.from(bin, "binary").toString("base64"));
|
|
||||||
function base64FromBytes(arr: Uint8Array): string {
|
|
||||||
const bin: string[] = [];
|
|
||||||
for (let i = 0; i < arr.byteLength; ++i) {
|
|
||||||
bin.push(String.fromCharCode(arr[i]));
|
|
||||||
}
|
|
||||||
return btoa(bin.join(""));
|
|
||||||
}
|
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
||||||
export type DeepPartial<T> = T extends Builtin
|
|
||||||
? T
|
|
||||||
: T extends Array<infer U>
|
|
||||||
? Array<DeepPartial<U>>
|
|
||||||
: T extends ReadonlyArray<infer U>
|
|
||||||
? ReadonlyArray<DeepPartial<U>>
|
|
||||||
: T extends {}
|
|
||||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
||||||
: Partial<T>;
|
|
||||||
|
|
||||||
function longToNumber(long: Long): number {
|
|
||||||
if (long.gt(Number.MAX_SAFE_INTEGER)) {
|
|
||||||
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
|
||||||
}
|
|
||||||
return long.toNumber();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (util.Long !== Long) {
|
|
||||||
util.Long = Long as any;
|
|
||||||
configure();
|
|
||||||
}
|
|
|
@ -1,301 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import { Writer, Reader } from "protobufjs/minimal";
|
|
||||||
|
|
||||||
export const protobufPackage = "cosmos.base.v1beta1";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Coin defines a token with a denomination and an amount.
|
|
||||||
*
|
|
||||||
* NOTE: The amount field is an Int which implements the custom method
|
|
||||||
* signatures required by gogoproto.
|
|
||||||
*/
|
|
||||||
export interface Coin {
|
|
||||||
denom: string;
|
|
||||||
amount: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* DecCoin defines a token with a denomination and a decimal amount.
|
|
||||||
*
|
|
||||||
* NOTE: The amount field is an Dec which implements the custom method
|
|
||||||
* signatures required by gogoproto.
|
|
||||||
*/
|
|
||||||
export interface DecCoin {
|
|
||||||
denom: string;
|
|
||||||
amount: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** IntProto defines a Protobuf wrapper around an Int object. */
|
|
||||||
export interface IntProto {
|
|
||||||
int: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** DecProto defines a Protobuf wrapper around a Dec object. */
|
|
||||||
export interface DecProto {
|
|
||||||
dec: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
const baseCoin: object = { denom: "", amount: "" };
|
|
||||||
|
|
||||||
export const Coin = {
|
|
||||||
encode(message: Coin, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.denom !== "") {
|
|
||||||
writer.uint32(10).string(message.denom);
|
|
||||||
}
|
|
||||||
if (message.amount !== "") {
|
|
||||||
writer.uint32(18).string(message.amount);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): Coin {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseCoin } as Coin;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.denom = reader.string();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.amount = reader.string();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): Coin {
|
|
||||||
const message = { ...baseCoin } as Coin;
|
|
||||||
if (object.denom !== undefined && object.denom !== null) {
|
|
||||||
message.denom = String(object.denom);
|
|
||||||
} else {
|
|
||||||
message.denom = "";
|
|
||||||
}
|
|
||||||
if (object.amount !== undefined && object.amount !== null) {
|
|
||||||
message.amount = String(object.amount);
|
|
||||||
} else {
|
|
||||||
message.amount = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: Coin): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.denom !== undefined && (obj.denom = message.denom);
|
|
||||||
message.amount !== undefined && (obj.amount = message.amount);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<Coin>): Coin {
|
|
||||||
const message = { ...baseCoin } as Coin;
|
|
||||||
if (object.denom !== undefined && object.denom !== null) {
|
|
||||||
message.denom = object.denom;
|
|
||||||
} else {
|
|
||||||
message.denom = "";
|
|
||||||
}
|
|
||||||
if (object.amount !== undefined && object.amount !== null) {
|
|
||||||
message.amount = object.amount;
|
|
||||||
} else {
|
|
||||||
message.amount = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseDecCoin: object = { denom: "", amount: "" };
|
|
||||||
|
|
||||||
export const DecCoin = {
|
|
||||||
encode(message: DecCoin, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.denom !== "") {
|
|
||||||
writer.uint32(10).string(message.denom);
|
|
||||||
}
|
|
||||||
if (message.amount !== "") {
|
|
||||||
writer.uint32(18).string(message.amount);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): DecCoin {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseDecCoin } as DecCoin;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.denom = reader.string();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.amount = reader.string();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): DecCoin {
|
|
||||||
const message = { ...baseDecCoin } as DecCoin;
|
|
||||||
if (object.denom !== undefined && object.denom !== null) {
|
|
||||||
message.denom = String(object.denom);
|
|
||||||
} else {
|
|
||||||
message.denom = "";
|
|
||||||
}
|
|
||||||
if (object.amount !== undefined && object.amount !== null) {
|
|
||||||
message.amount = String(object.amount);
|
|
||||||
} else {
|
|
||||||
message.amount = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: DecCoin): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.denom !== undefined && (obj.denom = message.denom);
|
|
||||||
message.amount !== undefined && (obj.amount = message.amount);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<DecCoin>): DecCoin {
|
|
||||||
const message = { ...baseDecCoin } as DecCoin;
|
|
||||||
if (object.denom !== undefined && object.denom !== null) {
|
|
||||||
message.denom = object.denom;
|
|
||||||
} else {
|
|
||||||
message.denom = "";
|
|
||||||
}
|
|
||||||
if (object.amount !== undefined && object.amount !== null) {
|
|
||||||
message.amount = object.amount;
|
|
||||||
} else {
|
|
||||||
message.amount = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseIntProto: object = { int: "" };
|
|
||||||
|
|
||||||
export const IntProto = {
|
|
||||||
encode(message: IntProto, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.int !== "") {
|
|
||||||
writer.uint32(10).string(message.int);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): IntProto {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseIntProto } as IntProto;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.int = reader.string();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): IntProto {
|
|
||||||
const message = { ...baseIntProto } as IntProto;
|
|
||||||
if (object.int !== undefined && object.int !== null) {
|
|
||||||
message.int = String(object.int);
|
|
||||||
} else {
|
|
||||||
message.int = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: IntProto): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.int !== undefined && (obj.int = message.int);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<IntProto>): IntProto {
|
|
||||||
const message = { ...baseIntProto } as IntProto;
|
|
||||||
if (object.int !== undefined && object.int !== null) {
|
|
||||||
message.int = object.int;
|
|
||||||
} else {
|
|
||||||
message.int = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseDecProto: object = { dec: "" };
|
|
||||||
|
|
||||||
export const DecProto = {
|
|
||||||
encode(message: DecProto, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.dec !== "") {
|
|
||||||
writer.uint32(10).string(message.dec);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): DecProto {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseDecProto } as DecProto;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.dec = reader.string();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): DecProto {
|
|
||||||
const message = { ...baseDecProto } as DecProto;
|
|
||||||
if (object.dec !== undefined && object.dec !== null) {
|
|
||||||
message.dec = String(object.dec);
|
|
||||||
} else {
|
|
||||||
message.dec = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: DecProto): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.dec !== undefined && (obj.dec = message.dec);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<DecProto>): DecProto {
|
|
||||||
const message = { ...baseDecProto } as DecProto;
|
|
||||||
if (object.dec !== undefined && object.dec !== null) {
|
|
||||||
message.dec = object.dec;
|
|
||||||
} else {
|
|
||||||
message.dec = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
||||||
export type DeepPartial<T> = T extends Builtin
|
|
||||||
? T
|
|
||||||
: T extends Array<infer U>
|
|
||||||
? Array<DeepPartial<U>>
|
|
||||||
: T extends ReadonlyArray<infer U>
|
|
||||||
? ReadonlyArray<DeepPartial<U>>
|
|
||||||
: T extends {}
|
|
||||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
||||||
: Partial<T>;
|
|
|
@ -1,2 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
export const protobufPackage = "cosmos_proto";
|
|
|
@ -1,2 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
export const protobufPackage = "gogoproto";
|
|
|
@ -1,2 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
export const protobufPackage = "google.api";
|
|
|
@ -1,706 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import { Writer, Reader } from "protobufjs/minimal";
|
|
||||||
|
|
||||||
export const protobufPackage = "google.api";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Defines the HTTP configuration for an API service. It contains a list of
|
|
||||||
* [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method
|
|
||||||
* to one or more HTTP REST API methods.
|
|
||||||
*/
|
|
||||||
export interface Http {
|
|
||||||
/**
|
|
||||||
* A list of HTTP configuration rules that apply to individual API methods.
|
|
||||||
*
|
|
||||||
* **NOTE:** All service configuration rules follow "last one wins" order.
|
|
||||||
*/
|
|
||||||
rules: HttpRule[];
|
|
||||||
/**
|
|
||||||
* When set to true, URL path parmeters will be fully URI-decoded except in
|
|
||||||
* cases of single segment matches in reserved expansion, where "%2F" will be
|
|
||||||
* left encoded.
|
|
||||||
*
|
|
||||||
* The default behavior is to not decode RFC 6570 reserved characters in multi
|
|
||||||
* segment matches.
|
|
||||||
*/
|
|
||||||
fully_decode_reserved_expansion: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* `HttpRule` defines the mapping of an RPC method to one or more HTTP
|
|
||||||
* REST API methods. The mapping specifies how different portions of the RPC
|
|
||||||
* request message are mapped to URL path, URL query parameters, and
|
|
||||||
* HTTP request body. The mapping is typically specified as an
|
|
||||||
* `google.api.http` annotation on the RPC method,
|
|
||||||
* see "google/api/annotations.proto" for details.
|
|
||||||
*
|
|
||||||
* The mapping consists of a field specifying the path template and
|
|
||||||
* method kind. The path template can refer to fields in the request
|
|
||||||
* message, as in the example below which describes a REST GET
|
|
||||||
* operation on a resource collection of messages:
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* service Messaging {
|
|
||||||
* rpc GetMessage(GetMessageRequest) returns (Message) {
|
|
||||||
* option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}";
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* message GetMessageRequest {
|
|
||||||
* message SubMessage {
|
|
||||||
* string subfield = 1;
|
|
||||||
* }
|
|
||||||
* string message_id = 1; // mapped to the URL
|
|
||||||
* SubMessage sub = 2; // `sub.subfield` is url-mapped
|
|
||||||
* }
|
|
||||||
* message Message {
|
|
||||||
* string text = 1; // content of the resource
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* The same http annotation can alternatively be expressed inside the
|
|
||||||
* `GRPC API Configuration` YAML file.
|
|
||||||
*
|
|
||||||
* http:
|
|
||||||
* rules:
|
|
||||||
* - selector: <proto_package_name>.Messaging.GetMessage
|
|
||||||
* get: /v1/messages/{message_id}/{sub.subfield}
|
|
||||||
*
|
|
||||||
* This definition enables an automatic, bidrectional mapping of HTTP
|
|
||||||
* JSON to RPC. Example:
|
|
||||||
*
|
|
||||||
* HTTP | RPC
|
|
||||||
* -----|-----
|
|
||||||
* `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))`
|
|
||||||
*
|
|
||||||
* In general, not only fields but also field paths can be referenced
|
|
||||||
* from a path pattern. Fields mapped to the path pattern cannot be
|
|
||||||
* repeated and must have a primitive (non-message) type.
|
|
||||||
*
|
|
||||||
* Any fields in the request message which are not bound by the path
|
|
||||||
* pattern automatically become (optional) HTTP query
|
|
||||||
* parameters. Assume the following definition of the request message:
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* service Messaging {
|
|
||||||
* rpc GetMessage(GetMessageRequest) returns (Message) {
|
|
||||||
* option (google.api.http).get = "/v1/messages/{message_id}";
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* message GetMessageRequest {
|
|
||||||
* message SubMessage {
|
|
||||||
* string subfield = 1;
|
|
||||||
* }
|
|
||||||
* string message_id = 1; // mapped to the URL
|
|
||||||
* int64 revision = 2; // becomes a parameter
|
|
||||||
* SubMessage sub = 3; // `sub.subfield` becomes a parameter
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* This enables a HTTP JSON to RPC mapping as below:
|
|
||||||
*
|
|
||||||
* HTTP | RPC
|
|
||||||
* -----|-----
|
|
||||||
* `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))`
|
|
||||||
*
|
|
||||||
* Note that fields which are mapped to HTTP parameters must have a
|
|
||||||
* primitive type or a repeated primitive type. Message types are not
|
|
||||||
* allowed. In the case of a repeated type, the parameter can be
|
|
||||||
* repeated in the URL, as in `...?param=A¶m=B`.
|
|
||||||
*
|
|
||||||
* For HTTP method kinds which allow a request body, the `body` field
|
|
||||||
* specifies the mapping. Consider a REST update method on the
|
|
||||||
* message resource collection:
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* service Messaging {
|
|
||||||
* rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
|
|
||||||
* option (google.api.http) = {
|
|
||||||
* put: "/v1/messages/{message_id}"
|
|
||||||
* body: "message"
|
|
||||||
* };
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* message UpdateMessageRequest {
|
|
||||||
* string message_id = 1; // mapped to the URL
|
|
||||||
* Message message = 2; // mapped to the body
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* The following HTTP JSON to RPC mapping is enabled, where the
|
|
||||||
* representation of the JSON in the request body is determined by
|
|
||||||
* protos JSON encoding:
|
|
||||||
*
|
|
||||||
* HTTP | RPC
|
|
||||||
* -----|-----
|
|
||||||
* `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })`
|
|
||||||
*
|
|
||||||
* The special name `*` can be used in the body mapping to define that
|
|
||||||
* every field not bound by the path template should be mapped to the
|
|
||||||
* request body. This enables the following alternative definition of
|
|
||||||
* the update method:
|
|
||||||
*
|
|
||||||
* service Messaging {
|
|
||||||
* rpc UpdateMessage(Message) returns (Message) {
|
|
||||||
* option (google.api.http) = {
|
|
||||||
* put: "/v1/messages/{message_id}"
|
|
||||||
* body: "*"
|
|
||||||
* };
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* message Message {
|
|
||||||
* string message_id = 1;
|
|
||||||
* string text = 2;
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* The following HTTP JSON to RPC mapping is enabled:
|
|
||||||
*
|
|
||||||
* HTTP | RPC
|
|
||||||
* -----|-----
|
|
||||||
* `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")`
|
|
||||||
*
|
|
||||||
* Note that when using `*` in the body mapping, it is not possible to
|
|
||||||
* have HTTP parameters, as all fields not bound by the path end in
|
|
||||||
* the body. This makes this option more rarely used in practice of
|
|
||||||
* defining REST APIs. The common usage of `*` is in custom methods
|
|
||||||
* which don't use the URL at all for transferring data.
|
|
||||||
*
|
|
||||||
* It is possible to define multiple HTTP methods for one RPC by using
|
|
||||||
* the `additional_bindings` option. Example:
|
|
||||||
*
|
|
||||||
* service Messaging {
|
|
||||||
* rpc GetMessage(GetMessageRequest) returns (Message) {
|
|
||||||
* option (google.api.http) = {
|
|
||||||
* get: "/v1/messages/{message_id}"
|
|
||||||
* additional_bindings {
|
|
||||||
* get: "/v1/users/{user_id}/messages/{message_id}"
|
|
||||||
* }
|
|
||||||
* };
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* message GetMessageRequest {
|
|
||||||
* string message_id = 1;
|
|
||||||
* string user_id = 2;
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* This enables the following two alternative HTTP JSON to RPC
|
|
||||||
* mappings:
|
|
||||||
*
|
|
||||||
* HTTP | RPC
|
|
||||||
* -----|-----
|
|
||||||
* `GET /v1/messages/123456` | `GetMessage(message_id: "123456")`
|
|
||||||
* `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")`
|
|
||||||
*
|
|
||||||
* # Rules for HTTP mapping
|
|
||||||
*
|
|
||||||
* The rules for mapping HTTP path, query parameters, and body fields
|
|
||||||
* to the request message are as follows:
|
|
||||||
*
|
|
||||||
* 1. The `body` field specifies either `*` or a field path, or is
|
|
||||||
* omitted. If omitted, it indicates there is no HTTP request body.
|
|
||||||
* 2. Leaf fields (recursive expansion of nested messages in the
|
|
||||||
* request) can be classified into three types:
|
|
||||||
* (a) Matched in the URL template.
|
|
||||||
* (b) Covered by body (if body is `*`, everything except (a) fields;
|
|
||||||
* else everything under the body field)
|
|
||||||
* (c) All other fields.
|
|
||||||
* 3. URL query parameters found in the HTTP request are mapped to (c) fields.
|
|
||||||
* 4. Any body sent with an HTTP request can contain only (b) fields.
|
|
||||||
*
|
|
||||||
* The syntax of the path template is as follows:
|
|
||||||
*
|
|
||||||
* Template = "/" Segments [ Verb ] ;
|
|
||||||
* Segments = Segment { "/" Segment } ;
|
|
||||||
* Segment = "*" | "**" | LITERAL | Variable ;
|
|
||||||
* Variable = "{" FieldPath [ "=" Segments ] "}" ;
|
|
||||||
* FieldPath = IDENT { "." IDENT } ;
|
|
||||||
* Verb = ":" LITERAL ;
|
|
||||||
*
|
|
||||||
* The syntax `*` matches a single path segment. The syntax `**` matches zero
|
|
||||||
* or more path segments, which must be the last part of the path except the
|
|
||||||
* `Verb`. The syntax `LITERAL` matches literal text in the path.
|
|
||||||
*
|
|
||||||
* The syntax `Variable` matches part of the URL path as specified by its
|
|
||||||
* template. A variable template must not contain other variables. If a variable
|
|
||||||
* matches a single path segment, its template may be omitted, e.g. `{var}`
|
|
||||||
* is equivalent to `{var=*}`.
|
|
||||||
*
|
|
||||||
* If a variable contains exactly one path segment, such as `"{var}"` or
|
|
||||||
* `"{var=*}"`, when such a variable is expanded into a URL path, all characters
|
|
||||||
* except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the
|
|
||||||
* Discovery Document as `{var}`.
|
|
||||||
*
|
|
||||||
* If a variable contains one or more path segments, such as `"{var=foo/*}"`
|
|
||||||
* or `"{var=**}"`, when such a variable is expanded into a URL path, all
|
|
||||||
* characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables
|
|
||||||
* show up in the Discovery Document as `{+var}`.
|
|
||||||
*
|
|
||||||
* NOTE: While the single segment variable matches the semantics of
|
|
||||||
* [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2
|
|
||||||
* Simple String Expansion, the multi segment variable **does not** match
|
|
||||||
* RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion
|
|
||||||
* does not expand special characters like `?` and `#`, which would lead
|
|
||||||
* to invalid URLs.
|
|
||||||
*
|
|
||||||
* NOTE: the field paths in variables and in the `body` must not refer to
|
|
||||||
* repeated fields or map fields.
|
|
||||||
*/
|
|
||||||
export interface HttpRule {
|
|
||||||
/**
|
|
||||||
* Selects methods to which this rule applies.
|
|
||||||
*
|
|
||||||
* Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
|
|
||||||
*/
|
|
||||||
selector: string;
|
|
||||||
/** Used for listing and getting information about resources. */
|
|
||||||
get: string | undefined;
|
|
||||||
/** Used for updating a resource. */
|
|
||||||
put: string | undefined;
|
|
||||||
/** Used for creating a resource. */
|
|
||||||
post: string | undefined;
|
|
||||||
/** Used for deleting a resource. */
|
|
||||||
delete: string | undefined;
|
|
||||||
/** Used for updating a resource. */
|
|
||||||
patch: string | undefined;
|
|
||||||
/**
|
|
||||||
* The custom pattern is used for specifying an HTTP method that is not
|
|
||||||
* included in the `pattern` field, such as HEAD, or "*" to leave the
|
|
||||||
* HTTP method unspecified for this rule. The wild-card rule is useful
|
|
||||||
* for services that provide content to Web (HTML) clients.
|
|
||||||
*/
|
|
||||||
custom: CustomHttpPattern | undefined;
|
|
||||||
/**
|
|
||||||
* The name of the request field whose value is mapped to the HTTP body, or
|
|
||||||
* `*` for mapping all fields not captured by the path pattern to the HTTP
|
|
||||||
* body. NOTE: the referred field must not be a repeated field and must be
|
|
||||||
* present at the top-level of request message type.
|
|
||||||
*/
|
|
||||||
body: string;
|
|
||||||
/**
|
|
||||||
* Optional. The name of the response field whose value is mapped to the HTTP
|
|
||||||
* body of response. Other response fields are ignored. When
|
|
||||||
* not set, the response message will be used as HTTP body of response.
|
|
||||||
*/
|
|
||||||
response_body: string;
|
|
||||||
/**
|
|
||||||
* Additional HTTP bindings for the selector. Nested bindings must
|
|
||||||
* not contain an `additional_bindings` field themselves (that is,
|
|
||||||
* the nesting may only be one level deep).
|
|
||||||
*/
|
|
||||||
additional_bindings: HttpRule[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** A custom pattern is used for defining custom HTTP verb. */
|
|
||||||
export interface CustomHttpPattern {
|
|
||||||
/** The name of this custom HTTP verb. */
|
|
||||||
kind: string;
|
|
||||||
/** The path matched by this custom verb. */
|
|
||||||
path: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
const baseHttp: object = { fully_decode_reserved_expansion: false };
|
|
||||||
|
|
||||||
export const Http = {
|
|
||||||
encode(message: Http, writer: Writer = Writer.create()): Writer {
|
|
||||||
for (const v of message.rules) {
|
|
||||||
HttpRule.encode(v!, writer.uint32(10).fork()).ldelim();
|
|
||||||
}
|
|
||||||
if (message.fully_decode_reserved_expansion === true) {
|
|
||||||
writer.uint32(16).bool(message.fully_decode_reserved_expansion);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): Http {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseHttp } as Http;
|
|
||||||
message.rules = [];
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.rules.push(HttpRule.decode(reader, reader.uint32()));
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.fully_decode_reserved_expansion = reader.bool();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): Http {
|
|
||||||
const message = { ...baseHttp } as Http;
|
|
||||||
message.rules = [];
|
|
||||||
if (object.rules !== undefined && object.rules !== null) {
|
|
||||||
for (const e of object.rules) {
|
|
||||||
message.rules.push(HttpRule.fromJSON(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.fully_decode_reserved_expansion !== undefined &&
|
|
||||||
object.fully_decode_reserved_expansion !== null
|
|
||||||
) {
|
|
||||||
message.fully_decode_reserved_expansion = Boolean(
|
|
||||||
object.fully_decode_reserved_expansion
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
message.fully_decode_reserved_expansion = false;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: Http): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
if (message.rules) {
|
|
||||||
obj.rules = message.rules.map((e) =>
|
|
||||||
e ? HttpRule.toJSON(e) : undefined
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
obj.rules = [];
|
|
||||||
}
|
|
||||||
message.fully_decode_reserved_expansion !== undefined &&
|
|
||||||
(obj.fully_decode_reserved_expansion =
|
|
||||||
message.fully_decode_reserved_expansion);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<Http>): Http {
|
|
||||||
const message = { ...baseHttp } as Http;
|
|
||||||
message.rules = [];
|
|
||||||
if (object.rules !== undefined && object.rules !== null) {
|
|
||||||
for (const e of object.rules) {
|
|
||||||
message.rules.push(HttpRule.fromPartial(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.fully_decode_reserved_expansion !== undefined &&
|
|
||||||
object.fully_decode_reserved_expansion !== null
|
|
||||||
) {
|
|
||||||
message.fully_decode_reserved_expansion =
|
|
||||||
object.fully_decode_reserved_expansion;
|
|
||||||
} else {
|
|
||||||
message.fully_decode_reserved_expansion = false;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseHttpRule: object = { selector: "", body: "", response_body: "" };
|
|
||||||
|
|
||||||
export const HttpRule = {
|
|
||||||
encode(message: HttpRule, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.selector !== "") {
|
|
||||||
writer.uint32(10).string(message.selector);
|
|
||||||
}
|
|
||||||
if (message.get !== undefined) {
|
|
||||||
writer.uint32(18).string(message.get);
|
|
||||||
}
|
|
||||||
if (message.put !== undefined) {
|
|
||||||
writer.uint32(26).string(message.put);
|
|
||||||
}
|
|
||||||
if (message.post !== undefined) {
|
|
||||||
writer.uint32(34).string(message.post);
|
|
||||||
}
|
|
||||||
if (message.delete !== undefined) {
|
|
||||||
writer.uint32(42).string(message.delete);
|
|
||||||
}
|
|
||||||
if (message.patch !== undefined) {
|
|
||||||
writer.uint32(50).string(message.patch);
|
|
||||||
}
|
|
||||||
if (message.custom !== undefined) {
|
|
||||||
CustomHttpPattern.encode(
|
|
||||||
message.custom,
|
|
||||||
writer.uint32(66).fork()
|
|
||||||
).ldelim();
|
|
||||||
}
|
|
||||||
if (message.body !== "") {
|
|
||||||
writer.uint32(58).string(message.body);
|
|
||||||
}
|
|
||||||
if (message.response_body !== "") {
|
|
||||||
writer.uint32(98).string(message.response_body);
|
|
||||||
}
|
|
||||||
for (const v of message.additional_bindings) {
|
|
||||||
HttpRule.encode(v!, writer.uint32(90).fork()).ldelim();
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): HttpRule {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseHttpRule } as HttpRule;
|
|
||||||
message.additional_bindings = [];
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.selector = reader.string();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.get = reader.string();
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
message.put = reader.string();
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
message.post = reader.string();
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
message.delete = reader.string();
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
message.patch = reader.string();
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
message.custom = CustomHttpPattern.decode(reader, reader.uint32());
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
message.body = reader.string();
|
|
||||||
break;
|
|
||||||
case 12:
|
|
||||||
message.response_body = reader.string();
|
|
||||||
break;
|
|
||||||
case 11:
|
|
||||||
message.additional_bindings.push(
|
|
||||||
HttpRule.decode(reader, reader.uint32())
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): HttpRule {
|
|
||||||
const message = { ...baseHttpRule } as HttpRule;
|
|
||||||
message.additional_bindings = [];
|
|
||||||
if (object.selector !== undefined && object.selector !== null) {
|
|
||||||
message.selector = String(object.selector);
|
|
||||||
} else {
|
|
||||||
message.selector = "";
|
|
||||||
}
|
|
||||||
if (object.get !== undefined && object.get !== null) {
|
|
||||||
message.get = String(object.get);
|
|
||||||
} else {
|
|
||||||
message.get = undefined;
|
|
||||||
}
|
|
||||||
if (object.put !== undefined && object.put !== null) {
|
|
||||||
message.put = String(object.put);
|
|
||||||
} else {
|
|
||||||
message.put = undefined;
|
|
||||||
}
|
|
||||||
if (object.post !== undefined && object.post !== null) {
|
|
||||||
message.post = String(object.post);
|
|
||||||
} else {
|
|
||||||
message.post = undefined;
|
|
||||||
}
|
|
||||||
if (object.delete !== undefined && object.delete !== null) {
|
|
||||||
message.delete = String(object.delete);
|
|
||||||
} else {
|
|
||||||
message.delete = undefined;
|
|
||||||
}
|
|
||||||
if (object.patch !== undefined && object.patch !== null) {
|
|
||||||
message.patch = String(object.patch);
|
|
||||||
} else {
|
|
||||||
message.patch = undefined;
|
|
||||||
}
|
|
||||||
if (object.custom !== undefined && object.custom !== null) {
|
|
||||||
message.custom = CustomHttpPattern.fromJSON(object.custom);
|
|
||||||
} else {
|
|
||||||
message.custom = undefined;
|
|
||||||
}
|
|
||||||
if (object.body !== undefined && object.body !== null) {
|
|
||||||
message.body = String(object.body);
|
|
||||||
} else {
|
|
||||||
message.body = "";
|
|
||||||
}
|
|
||||||
if (object.response_body !== undefined && object.response_body !== null) {
|
|
||||||
message.response_body = String(object.response_body);
|
|
||||||
} else {
|
|
||||||
message.response_body = "";
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.additional_bindings !== undefined &&
|
|
||||||
object.additional_bindings !== null
|
|
||||||
) {
|
|
||||||
for (const e of object.additional_bindings) {
|
|
||||||
message.additional_bindings.push(HttpRule.fromJSON(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: HttpRule): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.selector !== undefined && (obj.selector = message.selector);
|
|
||||||
message.get !== undefined && (obj.get = message.get);
|
|
||||||
message.put !== undefined && (obj.put = message.put);
|
|
||||||
message.post !== undefined && (obj.post = message.post);
|
|
||||||
message.delete !== undefined && (obj.delete = message.delete);
|
|
||||||
message.patch !== undefined && (obj.patch = message.patch);
|
|
||||||
message.custom !== undefined &&
|
|
||||||
(obj.custom = message.custom
|
|
||||||
? CustomHttpPattern.toJSON(message.custom)
|
|
||||||
: undefined);
|
|
||||||
message.body !== undefined && (obj.body = message.body);
|
|
||||||
message.response_body !== undefined &&
|
|
||||||
(obj.response_body = message.response_body);
|
|
||||||
if (message.additional_bindings) {
|
|
||||||
obj.additional_bindings = message.additional_bindings.map((e) =>
|
|
||||||
e ? HttpRule.toJSON(e) : undefined
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
obj.additional_bindings = [];
|
|
||||||
}
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<HttpRule>): HttpRule {
|
|
||||||
const message = { ...baseHttpRule } as HttpRule;
|
|
||||||
message.additional_bindings = [];
|
|
||||||
if (object.selector !== undefined && object.selector !== null) {
|
|
||||||
message.selector = object.selector;
|
|
||||||
} else {
|
|
||||||
message.selector = "";
|
|
||||||
}
|
|
||||||
if (object.get !== undefined && object.get !== null) {
|
|
||||||
message.get = object.get;
|
|
||||||
} else {
|
|
||||||
message.get = undefined;
|
|
||||||
}
|
|
||||||
if (object.put !== undefined && object.put !== null) {
|
|
||||||
message.put = object.put;
|
|
||||||
} else {
|
|
||||||
message.put = undefined;
|
|
||||||
}
|
|
||||||
if (object.post !== undefined && object.post !== null) {
|
|
||||||
message.post = object.post;
|
|
||||||
} else {
|
|
||||||
message.post = undefined;
|
|
||||||
}
|
|
||||||
if (object.delete !== undefined && object.delete !== null) {
|
|
||||||
message.delete = object.delete;
|
|
||||||
} else {
|
|
||||||
message.delete = undefined;
|
|
||||||
}
|
|
||||||
if (object.patch !== undefined && object.patch !== null) {
|
|
||||||
message.patch = object.patch;
|
|
||||||
} else {
|
|
||||||
message.patch = undefined;
|
|
||||||
}
|
|
||||||
if (object.custom !== undefined && object.custom !== null) {
|
|
||||||
message.custom = CustomHttpPattern.fromPartial(object.custom);
|
|
||||||
} else {
|
|
||||||
message.custom = undefined;
|
|
||||||
}
|
|
||||||
if (object.body !== undefined && object.body !== null) {
|
|
||||||
message.body = object.body;
|
|
||||||
} else {
|
|
||||||
message.body = "";
|
|
||||||
}
|
|
||||||
if (object.response_body !== undefined && object.response_body !== null) {
|
|
||||||
message.response_body = object.response_body;
|
|
||||||
} else {
|
|
||||||
message.response_body = "";
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.additional_bindings !== undefined &&
|
|
||||||
object.additional_bindings !== null
|
|
||||||
) {
|
|
||||||
for (const e of object.additional_bindings) {
|
|
||||||
message.additional_bindings.push(HttpRule.fromPartial(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseCustomHttpPattern: object = { kind: "", path: "" };
|
|
||||||
|
|
||||||
export const CustomHttpPattern = {
|
|
||||||
encode(message: CustomHttpPattern, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.kind !== "") {
|
|
||||||
writer.uint32(10).string(message.kind);
|
|
||||||
}
|
|
||||||
if (message.path !== "") {
|
|
||||||
writer.uint32(18).string(message.path);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): CustomHttpPattern {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseCustomHttpPattern } as CustomHttpPattern;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.kind = reader.string();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.path = reader.string();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): CustomHttpPattern {
|
|
||||||
const message = { ...baseCustomHttpPattern } as CustomHttpPattern;
|
|
||||||
if (object.kind !== undefined && object.kind !== null) {
|
|
||||||
message.kind = String(object.kind);
|
|
||||||
} else {
|
|
||||||
message.kind = "";
|
|
||||||
}
|
|
||||||
if (object.path !== undefined && object.path !== null) {
|
|
||||||
message.path = String(object.path);
|
|
||||||
} else {
|
|
||||||
message.path = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: CustomHttpPattern): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.kind !== undefined && (obj.kind = message.kind);
|
|
||||||
message.path !== undefined && (obj.path = message.path);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<CustomHttpPattern>): CustomHttpPattern {
|
|
||||||
const message = { ...baseCustomHttpPattern } as CustomHttpPattern;
|
|
||||||
if (object.kind !== undefined && object.kind !== null) {
|
|
||||||
message.kind = object.kind;
|
|
||||||
} else {
|
|
||||||
message.kind = "";
|
|
||||||
}
|
|
||||||
if (object.path !== undefined && object.path !== null) {
|
|
||||||
message.path = object.path;
|
|
||||||
} else {
|
|
||||||
message.path = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
||||||
export type DeepPartial<T> = T extends Builtin
|
|
||||||
? T
|
|
||||||
: T extends Array<infer U>
|
|
||||||
? Array<DeepPartial<U>>
|
|
||||||
: T extends ReadonlyArray<infer U>
|
|
||||||
? ReadonlyArray<DeepPartial<U>>
|
|
||||||
: T extends {}
|
|
||||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
||||||
: Partial<T>;
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,18 +0,0 @@
|
||||||
{
|
|
||||||
"name": "cosmos-bank-v1beta1-js",
|
|
||||||
"version": "0.1.0",
|
|
||||||
"description": "Autogenerated vuex store for Cosmos module cosmos.bank.v1beta1",
|
|
||||||
"author": "Starport Codegen <hello@tendermint.com>",
|
|
||||||
"homepage": "http://github.com/cosmos/cosmos-sdk/x/bank/types",
|
|
||||||
"license": "Apache-2.0",
|
|
||||||
"licenses": [
|
|
||||||
{
|
|
||||||
"type": "Apache-2.0",
|
|
||||||
"url": "http://www.apache.org/licenses/LICENSE-2.0"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"main": "index.js",
|
|
||||||
"publishConfig": {
|
|
||||||
"access": "public"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
THIS FILE IS GENERATED AUTOMATICALLY. DO NOT DELETE.
|
|
|
@ -1,298 +0,0 @@
|
||||||
import { txClient, queryClient, MissingWalletError , registry} from './module'
|
|
||||||
|
|
||||||
import { Validator } from "./module/types/cosmos/base/tendermint/v1beta1/query"
|
|
||||||
import { VersionInfo } from "./module/types/cosmos/base/tendermint/v1beta1/query"
|
|
||||||
import { Module } from "./module/types/cosmos/base/tendermint/v1beta1/query"
|
|
||||||
|
|
||||||
|
|
||||||
export { Validator, VersionInfo, Module };
|
|
||||||
|
|
||||||
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 {
|
|
||||||
GetNodeInfo: {},
|
|
||||||
GetSyncing: {},
|
|
||||||
GetLatestBlock: {},
|
|
||||||
GetBlockByHeight: {},
|
|
||||||
GetLatestValidatorSet: {},
|
|
||||||
GetValidatorSetByHeight: {},
|
|
||||||
|
|
||||||
_Structure: {
|
|
||||||
Validator: getStructure(Validator.fromPartial({})),
|
|
||||||
VersionInfo: getStructure(VersionInfo.fromPartial({})),
|
|
||||||
Module: getStructure(Module.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: {
|
|
||||||
getGetNodeInfo: (state) => (params = { params: {}}) => {
|
|
||||||
if (!(<any> params).query) {
|
|
||||||
(<any> params).query=null
|
|
||||||
}
|
|
||||||
return state.GetNodeInfo[JSON.stringify(params)] ?? {}
|
|
||||||
},
|
|
||||||
getGetSyncing: (state) => (params = { params: {}}) => {
|
|
||||||
if (!(<any> params).query) {
|
|
||||||
(<any> params).query=null
|
|
||||||
}
|
|
||||||
return state.GetSyncing[JSON.stringify(params)] ?? {}
|
|
||||||
},
|
|
||||||
getGetLatestBlock: (state) => (params = { params: {}}) => {
|
|
||||||
if (!(<any> params).query) {
|
|
||||||
(<any> params).query=null
|
|
||||||
}
|
|
||||||
return state.GetLatestBlock[JSON.stringify(params)] ?? {}
|
|
||||||
},
|
|
||||||
getGetBlockByHeight: (state) => (params = { params: {}}) => {
|
|
||||||
if (!(<any> params).query) {
|
|
||||||
(<any> params).query=null
|
|
||||||
}
|
|
||||||
return state.GetBlockByHeight[JSON.stringify(params)] ?? {}
|
|
||||||
},
|
|
||||||
getGetLatestValidatorSet: (state) => (params = { params: {}}) => {
|
|
||||||
if (!(<any> params).query) {
|
|
||||||
(<any> params).query=null
|
|
||||||
}
|
|
||||||
return state.GetLatestValidatorSet[JSON.stringify(params)] ?? {}
|
|
||||||
},
|
|
||||||
getGetValidatorSetByHeight: (state) => (params = { params: {}}) => {
|
|
||||||
if (!(<any> params).query) {
|
|
||||||
(<any> params).query=null
|
|
||||||
}
|
|
||||||
return state.GetValidatorSetByHeight[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.base.tendermint.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 ServiceGetNodeInfo({ 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.serviceGetNodeInfo()).data
|
|
||||||
|
|
||||||
|
|
||||||
commit('QUERY', { query: 'GetNodeInfo', key: { params: {...key}, query}, value })
|
|
||||||
if (subscribe) commit('SUBSCRIBE', { action: 'ServiceGetNodeInfo', payload: { options: { all }, params: {...key},query }})
|
|
||||||
return getters['getGetNodeInfo']( { params: {...key}, query}) ?? {}
|
|
||||||
} catch (e) {
|
|
||||||
throw new Error('QueryClient:ServiceGetNodeInfo API Node Unavailable. Could not perform query: ' + e.message)
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async ServiceGetSyncing({ 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.serviceGetSyncing()).data
|
|
||||||
|
|
||||||
|
|
||||||
commit('QUERY', { query: 'GetSyncing', key: { params: {...key}, query}, value })
|
|
||||||
if (subscribe) commit('SUBSCRIBE', { action: 'ServiceGetSyncing', payload: { options: { all }, params: {...key},query }})
|
|
||||||
return getters['getGetSyncing']( { params: {...key}, query}) ?? {}
|
|
||||||
} catch (e) {
|
|
||||||
throw new Error('QueryClient:ServiceGetSyncing API Node Unavailable. Could not perform query: ' + e.message)
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async ServiceGetLatestBlock({ 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.serviceGetLatestBlock()).data
|
|
||||||
|
|
||||||
|
|
||||||
commit('QUERY', { query: 'GetLatestBlock', key: { params: {...key}, query}, value })
|
|
||||||
if (subscribe) commit('SUBSCRIBE', { action: 'ServiceGetLatestBlock', payload: { options: { all }, params: {...key},query }})
|
|
||||||
return getters['getGetLatestBlock']( { params: {...key}, query}) ?? {}
|
|
||||||
} catch (e) {
|
|
||||||
throw new Error('QueryClient:ServiceGetLatestBlock API Node Unavailable. Could not perform query: ' + e.message)
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async ServiceGetBlockByHeight({ 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.serviceGetBlockByHeight( key.height)).data
|
|
||||||
|
|
||||||
|
|
||||||
commit('QUERY', { query: 'GetBlockByHeight', key: { params: {...key}, query}, value })
|
|
||||||
if (subscribe) commit('SUBSCRIBE', { action: 'ServiceGetBlockByHeight', payload: { options: { all }, params: {...key},query }})
|
|
||||||
return getters['getGetBlockByHeight']( { params: {...key}, query}) ?? {}
|
|
||||||
} catch (e) {
|
|
||||||
throw new Error('QueryClient:ServiceGetBlockByHeight API Node Unavailable. Could not perform query: ' + e.message)
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async ServiceGetLatestValidatorSet({ 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.serviceGetLatestValidatorSet(query)).data
|
|
||||||
|
|
||||||
|
|
||||||
while (all && (<any> value).pagination && (<any> value).pagination.next_key!=null) {
|
|
||||||
let next_values=(await queryClient.serviceGetLatestValidatorSet({...query, 'pagination.key':(<any> value).pagination.next_key})).data
|
|
||||||
value = mergeResults(value, next_values);
|
|
||||||
}
|
|
||||||
commit('QUERY', { query: 'GetLatestValidatorSet', key: { params: {...key}, query}, value })
|
|
||||||
if (subscribe) commit('SUBSCRIBE', { action: 'ServiceGetLatestValidatorSet', payload: { options: { all }, params: {...key},query }})
|
|
||||||
return getters['getGetLatestValidatorSet']( { params: {...key}, query}) ?? {}
|
|
||||||
} catch (e) {
|
|
||||||
throw new Error('QueryClient:ServiceGetLatestValidatorSet API Node Unavailable. Could not perform query: ' + e.message)
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async ServiceGetValidatorSetByHeight({ 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.serviceGetValidatorSetByHeight( key.height, query)).data
|
|
||||||
|
|
||||||
|
|
||||||
while (all && (<any> value).pagination && (<any> value).pagination.next_key!=null) {
|
|
||||||
let next_values=(await queryClient.serviceGetValidatorSetByHeight( key.height, {...query, 'pagination.key':(<any> value).pagination.next_key})).data
|
|
||||||
value = mergeResults(value, next_values);
|
|
||||||
}
|
|
||||||
commit('QUERY', { query: 'GetValidatorSetByHeight', key: { params: {...key}, query}, value })
|
|
||||||
if (subscribe) commit('SUBSCRIBE', { action: 'ServiceGetValidatorSetByHeight', payload: { options: { all }, params: {...key},query }})
|
|
||||||
return getters['getGetValidatorSetByHeight']( { params: {...key}, query}) ?? {}
|
|
||||||
} catch (e) {
|
|
||||||
throw new Error('QueryClient:ServiceGetValidatorSetByHeight API Node Unavailable. Could not perform query: ' + e.message)
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,57 +0,0 @@
|
||||||
// THIS FILE IS GENERATED AUTOMATICALLY. DO NOT MODIFY.
|
|
||||||
|
|
||||||
import { StdFee } from "@cosmjs/launchpad";
|
|
||||||
import { SigningStargateClient } from "@cosmjs/stargate";
|
|
||||||
import { Registry, OfflineSigner, EncodeObject, DirectSecp256k1HdWallet } from "@cosmjs/proto-signing";
|
|
||||||
import { Api } from "./rest";
|
|
||||||
|
|
||||||
|
|
||||||
const types = [
|
|
||||||
|
|
||||||
];
|
|
||||||
export const MissingWalletError = new Error("wallet is required");
|
|
||||||
|
|
||||||
export const registry = new Registry(<any>types);
|
|
||||||
|
|
||||||
const defaultFee = {
|
|
||||||
amount: [],
|
|
||||||
gas: "200000",
|
|
||||||
};
|
|
||||||
|
|
||||||
interface TxClientOptions {
|
|
||||||
addr: string
|
|
||||||
}
|
|
||||||
|
|
||||||
interface SignAndBroadcastOptions {
|
|
||||||
fee: StdFee,
|
|
||||||
memo?: string
|
|
||||||
}
|
|
||||||
|
|
||||||
const txClient = async (wallet: OfflineSigner, { addr: addr }: TxClientOptions = { addr: "http://localhost:26657" }) => {
|
|
||||||
if (!wallet) throw MissingWalletError;
|
|
||||||
let client;
|
|
||||||
if (addr) {
|
|
||||||
client = await SigningStargateClient.connectWithSigner(addr, wallet, { registry });
|
|
||||||
}else{
|
|
||||||
client = await SigningStargateClient.offline( wallet, { registry });
|
|
||||||
}
|
|
||||||
const { address } = (await wallet.getAccounts())[0];
|
|
||||||
|
|
||||||
return {
|
|
||||||
signAndBroadcast: (msgs: EncodeObject[], { fee, memo }: SignAndBroadcastOptions = {fee: defaultFee, memo: ""}) => client.signAndBroadcast(address, msgs, fee,memo),
|
|
||||||
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
interface QueryClientOptions {
|
|
||||||
addr: string
|
|
||||||
}
|
|
||||||
|
|
||||||
const queryClient = async ({ addr: addr }: QueryClientOptions = { addr: "http://localhost:1317" }) => {
|
|
||||||
return new Api({ baseUrl: addr });
|
|
||||||
};
|
|
||||||
|
|
||||||
export {
|
|
||||||
txClient,
|
|
||||||
queryClient,
|
|
||||||
};
|
|
|
@ -1,987 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
/* tslint:disable */
|
|
||||||
/*
|
|
||||||
* ---------------------------------------------------------------
|
|
||||||
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
|
|
||||||
* ## ##
|
|
||||||
* ## AUTHOR: acacode ##
|
|
||||||
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
|
|
||||||
* ---------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
export interface CryptoPublicKey {
|
|
||||||
/** @format byte */
|
|
||||||
ed25519?: string;
|
|
||||||
|
|
||||||
/** @format byte */
|
|
||||||
secp256k1?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface P2PDefaultNodeInfo {
|
|
||||||
protocol_version?: P2PProtocolVersion;
|
|
||||||
default_node_id?: string;
|
|
||||||
listen_addr?: string;
|
|
||||||
network?: string;
|
|
||||||
version?: string;
|
|
||||||
|
|
||||||
/** @format byte */
|
|
||||||
channels?: string;
|
|
||||||
moniker?: string;
|
|
||||||
other?: P2PDefaultNodeInfoOther;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface P2PDefaultNodeInfoOther {
|
|
||||||
tx_index?: string;
|
|
||||||
rpc_address?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface P2PProtocolVersion {
|
|
||||||
/** @format uint64 */
|
|
||||||
p2p?: string;
|
|
||||||
|
|
||||||
/** @format uint64 */
|
|
||||||
block?: string;
|
|
||||||
|
|
||||||
/** @format uint64 */
|
|
||||||
app?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* `Any` contains an arbitrary serialized protocol buffer message along with a
|
|
||||||
URL that describes the type of the serialized message.
|
|
||||||
|
|
||||||
Protobuf library provides support to pack/unpack Any values in the form
|
|
||||||
of utility functions or additional generated methods of the Any type.
|
|
||||||
|
|
||||||
Example 1: Pack and unpack a message in C++.
|
|
||||||
|
|
||||||
Foo foo = ...;
|
|
||||||
Any any;
|
|
||||||
any.PackFrom(foo);
|
|
||||||
...
|
|
||||||
if (any.UnpackTo(&foo)) {
|
|
||||||
...
|
|
||||||
}
|
|
||||||
|
|
||||||
Example 2: Pack and unpack a message in Java.
|
|
||||||
|
|
||||||
Foo foo = ...;
|
|
||||||
Any any = Any.pack(foo);
|
|
||||||
...
|
|
||||||
if (any.is(Foo.class)) {
|
|
||||||
foo = any.unpack(Foo.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
Example 3: Pack and unpack a message in Python.
|
|
||||||
|
|
||||||
foo = Foo(...)
|
|
||||||
any = Any()
|
|
||||||
any.Pack(foo)
|
|
||||||
...
|
|
||||||
if any.Is(Foo.DESCRIPTOR):
|
|
||||||
any.Unpack(foo)
|
|
||||||
...
|
|
||||||
|
|
||||||
Example 4: Pack and unpack a message in Go
|
|
||||||
|
|
||||||
foo := &pb.Foo{...}
|
|
||||||
any, err := anypb.New(foo)
|
|
||||||
if err != nil {
|
|
||||||
...
|
|
||||||
}
|
|
||||||
...
|
|
||||||
foo := &pb.Foo{}
|
|
||||||
if err := any.UnmarshalTo(foo); err != nil {
|
|
||||||
...
|
|
||||||
}
|
|
||||||
|
|
||||||
The pack methods provided by protobuf library will by default use
|
|
||||||
'type.googleapis.com/full.type.name' as the type URL and the unpack
|
|
||||||
methods only use the fully qualified type name after the last '/'
|
|
||||||
in the type URL, for example "foo.bar.com/x/y.z" will yield type
|
|
||||||
name "y.z".
|
|
||||||
|
|
||||||
|
|
||||||
JSON
|
|
||||||
====
|
|
||||||
The JSON representation of an `Any` value uses the regular
|
|
||||||
representation of the deserialized, embedded message, with an
|
|
||||||
additional field `@type` which contains the type URL. Example:
|
|
||||||
|
|
||||||
package google.profile;
|
|
||||||
message Person {
|
|
||||||
string first_name = 1;
|
|
||||||
string last_name = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
"@type": "type.googleapis.com/google.profile.Person",
|
|
||||||
"firstName": <string>,
|
|
||||||
"lastName": <string>
|
|
||||||
}
|
|
||||||
|
|
||||||
If the embedded message type is well-known and has a custom JSON
|
|
||||||
representation, that representation will be embedded adding a field
|
|
||||||
`value` which holds the custom JSON in addition to the `@type`
|
|
||||||
field. Example (for message [google.protobuf.Duration][]):
|
|
||||||
|
|
||||||
{
|
|
||||||
"@type": "type.googleapis.com/google.protobuf.Duration",
|
|
||||||
"value": "1.212s"
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
export interface ProtobufAny {
|
|
||||||
/**
|
|
||||||
* A URL/resource name that uniquely identifies the type of the serialized
|
|
||||||
* protocol buffer message. This string must contain at least
|
|
||||||
* one "/" character. The last segment of the URL's path must represent
|
|
||||||
* the fully qualified name of the type (as in
|
|
||||||
* `path/google.protobuf.Duration`). The name should be in a canonical form
|
|
||||||
* (e.g., leading "." is not accepted).
|
|
||||||
*
|
|
||||||
* In practice, teams usually precompile into the binary all types that they
|
|
||||||
* expect it to use in the context of Any. However, for URLs which use the
|
|
||||||
* scheme `http`, `https`, or no scheme, one can optionally set up a type
|
|
||||||
* server that maps type URLs to message definitions as follows:
|
|
||||||
*
|
|
||||||
* * If no scheme is provided, `https` is assumed.
|
|
||||||
* * An HTTP GET on the URL must yield a [google.protobuf.Type][]
|
|
||||||
* value in binary format, or produce an error.
|
|
||||||
* * Applications are allowed to cache lookup results based on the
|
|
||||||
* URL, or have them precompiled into a binary to avoid any
|
|
||||||
* lookup. Therefore, binary compatibility needs to be preserved
|
|
||||||
* on changes to types. (Use versioned type names to manage
|
|
||||||
* breaking changes.)
|
|
||||||
*
|
|
||||||
* Note: this functionality is not currently available in the official
|
|
||||||
* protobuf release, and it is not used for type URLs beginning with
|
|
||||||
* type.googleapis.com.
|
|
||||||
*
|
|
||||||
* Schemes other than `http`, `https` (or the empty scheme) might be
|
|
||||||
* used with implementation specific semantics.
|
|
||||||
*/
|
|
||||||
"@type"?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface RpcStatus {
|
|
||||||
/** @format int32 */
|
|
||||||
code?: number;
|
|
||||||
message?: string;
|
|
||||||
details?: ProtobufAny[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TenderminttypesValidator {
|
|
||||||
/** @format byte */
|
|
||||||
address?: string;
|
|
||||||
pub_key?: CryptoPublicKey;
|
|
||||||
|
|
||||||
/** @format int64 */
|
|
||||||
voting_power?: string;
|
|
||||||
|
|
||||||
/** @format int64 */
|
|
||||||
proposer_priority?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Validator is the type for the validator-set.
|
|
||||||
*/
|
|
||||||
export interface Tendermintv1Beta1Validator {
|
|
||||||
address?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* `Any` contains an arbitrary serialized protocol buffer message along with a
|
|
||||||
* URL that describes the type of the serialized message.
|
|
||||||
*
|
|
||||||
* Protobuf library provides support to pack/unpack Any values in the form
|
|
||||||
* of utility functions or additional generated methods of the Any type.
|
|
||||||
*
|
|
||||||
* Example 1: Pack and unpack a message in C++.
|
|
||||||
*
|
|
||||||
* Foo foo = ...;
|
|
||||||
* Any any;
|
|
||||||
* any.PackFrom(foo);
|
|
||||||
* ...
|
|
||||||
* if (any.UnpackTo(&foo)) {
|
|
||||||
* ...
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* Example 2: Pack and unpack a message in Java.
|
|
||||||
*
|
|
||||||
* Foo foo = ...;
|
|
||||||
* Any any = Any.pack(foo);
|
|
||||||
* ...
|
|
||||||
* if (any.is(Foo.class)) {
|
|
||||||
* foo = any.unpack(Foo.class);
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* Example 3: Pack and unpack a message in Python.
|
|
||||||
*
|
|
||||||
* foo = Foo(...)
|
|
||||||
* any = Any()
|
|
||||||
* any.Pack(foo)
|
|
||||||
* ...
|
|
||||||
* if any.Is(Foo.DESCRIPTOR):
|
|
||||||
* any.Unpack(foo)
|
|
||||||
* ...
|
|
||||||
*
|
|
||||||
* Example 4: Pack and unpack a message in Go
|
|
||||||
*
|
|
||||||
* foo := &pb.Foo{...}
|
|
||||||
* any, err := anypb.New(foo)
|
|
||||||
* if err != nil {
|
|
||||||
* ...
|
|
||||||
* }
|
|
||||||
* ...
|
|
||||||
* foo := &pb.Foo{}
|
|
||||||
* if err := any.UnmarshalTo(foo); err != nil {
|
|
||||||
* ...
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* The pack methods provided by protobuf library will by default use
|
|
||||||
* 'type.googleapis.com/full.type.name' as the type URL and the unpack
|
|
||||||
* methods only use the fully qualified type name after the last '/'
|
|
||||||
* in the type URL, for example "foo.bar.com/x/y.z" will yield type
|
|
||||||
* name "y.z".
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* JSON
|
|
||||||
* ====
|
|
||||||
* The JSON representation of an `Any` value uses the regular
|
|
||||||
* representation of the deserialized, embedded message, with an
|
|
||||||
* additional field `@type` which contains the type URL. Example:
|
|
||||||
*
|
|
||||||
* package google.profile;
|
|
||||||
* message Person {
|
|
||||||
* string first_name = 1;
|
|
||||||
* string last_name = 2;
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* {
|
|
||||||
* "@type": "type.googleapis.com/google.profile.Person",
|
|
||||||
* "firstName": <string>,
|
|
||||||
* "lastName": <string>
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* If the embedded message type is well-known and has a custom JSON
|
|
||||||
* representation, that representation will be embedded adding a field
|
|
||||||
* `value` which holds the custom JSON in addition to the `@type`
|
|
||||||
* field. Example (for message [google.protobuf.Duration][]):
|
|
||||||
*
|
|
||||||
* {
|
|
||||||
* "@type": "type.googleapis.com/google.protobuf.Duration",
|
|
||||||
* "value": "1.212s"
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
pub_key?: ProtobufAny;
|
|
||||||
|
|
||||||
/** @format int64 */
|
|
||||||
voting_power?: string;
|
|
||||||
|
|
||||||
/** @format int64 */
|
|
||||||
proposer_priority?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TypesBlock {
|
|
||||||
/** Header defines the structure of a Tendermint block header. */
|
|
||||||
header?: TypesHeader;
|
|
||||||
data?: TypesData;
|
|
||||||
evidence?: TypesEvidenceList;
|
|
||||||
|
|
||||||
/** Commit contains the evidence that a block was committed by a set of validators. */
|
|
||||||
last_commit?: TypesCommit;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TypesBlockID {
|
|
||||||
/** @format byte */
|
|
||||||
hash?: string;
|
|
||||||
part_set_header?: TypesPartSetHeader;
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum TypesBlockIDFlag {
|
|
||||||
BLOCK_ID_FLAG_UNKNOWN = "BLOCK_ID_FLAG_UNKNOWN",
|
|
||||||
BLOCK_ID_FLAG_ABSENT = "BLOCK_ID_FLAG_ABSENT",
|
|
||||||
BLOCK_ID_FLAG_COMMIT = "BLOCK_ID_FLAG_COMMIT",
|
|
||||||
BLOCK_ID_FLAG_NIL = "BLOCK_ID_FLAG_NIL",
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Commit contains the evidence that a block was committed by a set of validators.
|
|
||||||
*/
|
|
||||||
export interface TypesCommit {
|
|
||||||
/** @format int64 */
|
|
||||||
height?: string;
|
|
||||||
|
|
||||||
/** @format int32 */
|
|
||||||
round?: number;
|
|
||||||
block_id?: TypesBlockID;
|
|
||||||
signatures?: TypesCommitSig[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CommitSig is a part of the Vote included in a Commit.
|
|
||||||
*/
|
|
||||||
export interface TypesCommitSig {
|
|
||||||
block_id_flag?: TypesBlockIDFlag;
|
|
||||||
|
|
||||||
/** @format byte */
|
|
||||||
validator_address?: string;
|
|
||||||
|
|
||||||
/** @format date-time */
|
|
||||||
timestamp?: string;
|
|
||||||
|
|
||||||
/** @format byte */
|
|
||||||
signature?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TypesData {
|
|
||||||
/**
|
|
||||||
* Txs that will be applied by state @ block.Height+1.
|
|
||||||
* NOTE: not all txs here are valid. We're just agreeing on the order first.
|
|
||||||
* This means that block.AppHash does not include these txs.
|
|
||||||
*/
|
|
||||||
txs?: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* DuplicateVoteEvidence contains evidence of a validator signed two conflicting votes.
|
|
||||||
*/
|
|
||||||
export interface TypesDuplicateVoteEvidence {
|
|
||||||
/**
|
|
||||||
* Vote represents a prevote, precommit, or commit vote from validators for
|
|
||||||
* consensus.
|
|
||||||
*/
|
|
||||||
vote_a?: TypesVote;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Vote represents a prevote, precommit, or commit vote from validators for
|
|
||||||
* consensus.
|
|
||||||
*/
|
|
||||||
vote_b?: TypesVote;
|
|
||||||
|
|
||||||
/** @format int64 */
|
|
||||||
total_voting_power?: string;
|
|
||||||
|
|
||||||
/** @format int64 */
|
|
||||||
validator_power?: string;
|
|
||||||
|
|
||||||
/** @format date-time */
|
|
||||||
timestamp?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TypesEvidence {
|
|
||||||
/** DuplicateVoteEvidence contains evidence of a validator signed two conflicting votes. */
|
|
||||||
duplicate_vote_evidence?: TypesDuplicateVoteEvidence;
|
|
||||||
|
|
||||||
/** LightClientAttackEvidence contains evidence of a set of validators attempting to mislead a light client. */
|
|
||||||
light_client_attack_evidence?: TypesLightClientAttackEvidence;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TypesEvidenceList {
|
|
||||||
evidence?: TypesEvidence[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Header defines the structure of a Tendermint block header.
|
|
||||||
*/
|
|
||||||
export interface TypesHeader {
|
|
||||||
/**
|
|
||||||
* Consensus captures the consensus rules for processing a block in the blockchain,
|
|
||||||
* including all blockchain data structures and the rules of the application's
|
|
||||||
* state transition machine.
|
|
||||||
*/
|
|
||||||
version?: VersionConsensus;
|
|
||||||
chain_id?: string;
|
|
||||||
|
|
||||||
/** @format int64 */
|
|
||||||
height?: string;
|
|
||||||
|
|
||||||
/** @format date-time */
|
|
||||||
time?: string;
|
|
||||||
last_block_id?: TypesBlockID;
|
|
||||||
|
|
||||||
/** @format byte */
|
|
||||||
last_commit_hash?: string;
|
|
||||||
|
|
||||||
/** @format byte */
|
|
||||||
data_hash?: string;
|
|
||||||
|
|
||||||
/** @format byte */
|
|
||||||
validators_hash?: string;
|
|
||||||
|
|
||||||
/** @format byte */
|
|
||||||
next_validators_hash?: string;
|
|
||||||
|
|
||||||
/** @format byte */
|
|
||||||
consensus_hash?: string;
|
|
||||||
|
|
||||||
/** @format byte */
|
|
||||||
app_hash?: string;
|
|
||||||
|
|
||||||
/** @format byte */
|
|
||||||
last_results_hash?: string;
|
|
||||||
|
|
||||||
/** @format byte */
|
|
||||||
evidence_hash?: string;
|
|
||||||
|
|
||||||
/** @format byte */
|
|
||||||
proposer_address?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TypesLightBlock {
|
|
||||||
signed_header?: TypesSignedHeader;
|
|
||||||
validator_set?: TypesValidatorSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* LightClientAttackEvidence contains evidence of a set of validators attempting to mislead a light client.
|
|
||||||
*/
|
|
||||||
export interface TypesLightClientAttackEvidence {
|
|
||||||
conflicting_block?: TypesLightBlock;
|
|
||||||
|
|
||||||
/** @format int64 */
|
|
||||||
common_height?: string;
|
|
||||||
byzantine_validators?: TenderminttypesValidator[];
|
|
||||||
|
|
||||||
/** @format int64 */
|
|
||||||
total_voting_power?: string;
|
|
||||||
|
|
||||||
/** @format date-time */
|
|
||||||
timestamp?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TypesPartSetHeader {
|
|
||||||
/** @format int64 */
|
|
||||||
total?: number;
|
|
||||||
|
|
||||||
/** @format byte */
|
|
||||||
hash?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TypesSignedHeader {
|
|
||||||
/** Header defines the structure of a Tendermint block header. */
|
|
||||||
header?: TypesHeader;
|
|
||||||
|
|
||||||
/** Commit contains the evidence that a block was committed by a set of validators. */
|
|
||||||
commit?: TypesCommit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SignedMsgType is a type of signed message in the consensus.
|
|
||||||
|
|
||||||
- SIGNED_MSG_TYPE_PREVOTE: Votes
|
|
||||||
- SIGNED_MSG_TYPE_PROPOSAL: Proposals
|
|
||||||
*/
|
|
||||||
export enum TypesSignedMsgType {
|
|
||||||
SIGNED_MSG_TYPE_UNKNOWN = "SIGNED_MSG_TYPE_UNKNOWN",
|
|
||||||
SIGNED_MSG_TYPE_PREVOTE = "SIGNED_MSG_TYPE_PREVOTE",
|
|
||||||
SIGNED_MSG_TYPE_PRECOMMIT = "SIGNED_MSG_TYPE_PRECOMMIT",
|
|
||||||
SIGNED_MSG_TYPE_PROPOSAL = "SIGNED_MSG_TYPE_PROPOSAL",
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TypesValidatorSet {
|
|
||||||
validators?: TenderminttypesValidator[];
|
|
||||||
proposer?: TenderminttypesValidator;
|
|
||||||
|
|
||||||
/** @format int64 */
|
|
||||||
total_voting_power?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Vote represents a prevote, precommit, or commit vote from validators for
|
|
||||||
consensus.
|
|
||||||
*/
|
|
||||||
export interface TypesVote {
|
|
||||||
/**
|
|
||||||
* SignedMsgType is a type of signed message in the consensus.
|
|
||||||
*
|
|
||||||
* - SIGNED_MSG_TYPE_PREVOTE: Votes
|
|
||||||
* - SIGNED_MSG_TYPE_PROPOSAL: Proposals
|
|
||||||
*/
|
|
||||||
type?: TypesSignedMsgType;
|
|
||||||
|
|
||||||
/** @format int64 */
|
|
||||||
height?: string;
|
|
||||||
|
|
||||||
/** @format int32 */
|
|
||||||
round?: number;
|
|
||||||
block_id?: TypesBlockID;
|
|
||||||
|
|
||||||
/** @format date-time */
|
|
||||||
timestamp?: string;
|
|
||||||
|
|
||||||
/** @format byte */
|
|
||||||
validator_address?: string;
|
|
||||||
|
|
||||||
/** @format int32 */
|
|
||||||
validator_index?: number;
|
|
||||||
|
|
||||||
/** @format byte */
|
|
||||||
signature?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GetBlockByHeightResponse is the response type for the Query/GetBlockByHeight RPC method.
|
|
||||||
*/
|
|
||||||
export interface V1Beta1GetBlockByHeightResponse {
|
|
||||||
block_id?: TypesBlockID;
|
|
||||||
block?: TypesBlock;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GetLatestBlockResponse is the response type for the Query/GetLatestBlock RPC method.
|
|
||||||
*/
|
|
||||||
export interface V1Beta1GetLatestBlockResponse {
|
|
||||||
block_id?: TypesBlockID;
|
|
||||||
block?: TypesBlock;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GetLatestValidatorSetResponse is the response type for the Query/GetValidatorSetByHeight RPC method.
|
|
||||||
*/
|
|
||||||
export interface V1Beta1GetLatestValidatorSetResponse {
|
|
||||||
/** @format int64 */
|
|
||||||
block_height?: string;
|
|
||||||
validators?: Tendermintv1Beta1Validator[];
|
|
||||||
|
|
||||||
/** pagination defines an pagination for the response. */
|
|
||||||
pagination?: V1Beta1PageResponse;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GetNodeInfoResponse is the request type for the Query/GetNodeInfo RPC method.
|
|
||||||
*/
|
|
||||||
export interface V1Beta1GetNodeInfoResponse {
|
|
||||||
default_node_info?: P2PDefaultNodeInfo;
|
|
||||||
|
|
||||||
/** VersionInfo is the type for the GetNodeInfoResponse message. */
|
|
||||||
application_version?: V1Beta1VersionInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GetSyncingResponse is the response type for the Query/GetSyncing RPC method.
|
|
||||||
*/
|
|
||||||
export interface V1Beta1GetSyncingResponse {
|
|
||||||
syncing?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GetValidatorSetByHeightResponse is the response type for the Query/GetValidatorSetByHeight RPC method.
|
|
||||||
*/
|
|
||||||
export interface V1Beta1GetValidatorSetByHeightResponse {
|
|
||||||
/** @format int64 */
|
|
||||||
block_height?: string;
|
|
||||||
validators?: Tendermintv1Beta1Validator[];
|
|
||||||
|
|
||||||
/** pagination defines an pagination for the response. */
|
|
||||||
pagination?: V1Beta1PageResponse;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface V1Beta1Module {
|
|
||||||
path?: string;
|
|
||||||
version?: string;
|
|
||||||
sum?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* message SomeRequest {
|
|
||||||
Foo some_parameter = 1;
|
|
||||||
PageRequest pagination = 2;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
export interface V1Beta1PageRequest {
|
|
||||||
/**
|
|
||||||
* key is a value returned in PageResponse.next_key to begin
|
|
||||||
* querying the next page most efficiently. Only one of offset or key
|
|
||||||
* should be set.
|
|
||||||
* @format byte
|
|
||||||
*/
|
|
||||||
key?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* offset is a numeric offset that can be used when key is unavailable.
|
|
||||||
* It is less efficient than using key. Only one of offset or key should
|
|
||||||
* be set.
|
|
||||||
* @format uint64
|
|
||||||
*/
|
|
||||||
offset?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* limit is the total number of results to be returned in the result page.
|
|
||||||
* If left empty it will default to a value to be set by each app.
|
|
||||||
* @format uint64
|
|
||||||
*/
|
|
||||||
limit?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* count_total is set to true to indicate that the result set should include
|
|
||||||
* a count of the total number of items available for pagination in UIs.
|
|
||||||
* count_total is only respected when offset is used. It is ignored when key
|
|
||||||
* is set.
|
|
||||||
*/
|
|
||||||
count_total?: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* reverse is set to true if results are to be returned in the descending order.
|
|
||||||
*
|
|
||||||
* Since: cosmos-sdk 0.43
|
|
||||||
*/
|
|
||||||
reverse?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PageResponse is to be embedded in gRPC response messages where the
|
|
||||||
corresponding request message has used PageRequest.
|
|
||||||
|
|
||||||
message SomeResponse {
|
|
||||||
repeated Bar results = 1;
|
|
||||||
PageResponse page = 2;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
export interface V1Beta1PageResponse {
|
|
||||||
/** @format byte */
|
|
||||||
next_key?: string;
|
|
||||||
|
|
||||||
/** @format uint64 */
|
|
||||||
total?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* VersionInfo is the type for the GetNodeInfoResponse message.
|
|
||||||
*/
|
|
||||||
export interface V1Beta1VersionInfo {
|
|
||||||
name?: string;
|
|
||||||
app_name?: string;
|
|
||||||
version?: string;
|
|
||||||
git_commit?: string;
|
|
||||||
build_tags?: string;
|
|
||||||
go_version?: string;
|
|
||||||
build_deps?: V1Beta1Module[];
|
|
||||||
cosmos_sdk_version?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Consensus captures the consensus rules for processing a block in the blockchain,
|
|
||||||
including all blockchain data structures and the rules of the application's
|
|
||||||
state transition machine.
|
|
||||||
*/
|
|
||||||
export interface VersionConsensus {
|
|
||||||
/** @format uint64 */
|
|
||||||
block?: string;
|
|
||||||
|
|
||||||
/** @format uint64 */
|
|
||||||
app?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type QueryParamsType = Record<string | number, any>;
|
|
||||||
export type ResponseFormat = keyof Omit<Body, "body" | "bodyUsed">;
|
|
||||||
|
|
||||||
export interface FullRequestParams extends Omit<RequestInit, "body"> {
|
|
||||||
/** set parameter to `true` for call `securityWorker` for this request */
|
|
||||||
secure?: boolean;
|
|
||||||
/** request path */
|
|
||||||
path: string;
|
|
||||||
/** content type of request body */
|
|
||||||
type?: ContentType;
|
|
||||||
/** query params */
|
|
||||||
query?: QueryParamsType;
|
|
||||||
/** format of response (i.e. response.json() -> format: "json") */
|
|
||||||
format?: keyof Omit<Body, "body" | "bodyUsed">;
|
|
||||||
/** request body */
|
|
||||||
body?: unknown;
|
|
||||||
/** base url */
|
|
||||||
baseUrl?: string;
|
|
||||||
/** request cancellation token */
|
|
||||||
cancelToken?: CancelToken;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type RequestParams = Omit<FullRequestParams, "body" | "method" | "query" | "path">;
|
|
||||||
|
|
||||||
export interface ApiConfig<SecurityDataType = unknown> {
|
|
||||||
baseUrl?: string;
|
|
||||||
baseApiParams?: Omit<RequestParams, "baseUrl" | "cancelToken" | "signal">;
|
|
||||||
securityWorker?: (securityData: SecurityDataType) => RequestParams | void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
|
|
||||||
data: D;
|
|
||||||
error: E;
|
|
||||||
}
|
|
||||||
|
|
||||||
type CancelToken = Symbol | string | number;
|
|
||||||
|
|
||||||
export enum ContentType {
|
|
||||||
Json = "application/json",
|
|
||||||
FormData = "multipart/form-data",
|
|
||||||
UrlEncoded = "application/x-www-form-urlencoded",
|
|
||||||
}
|
|
||||||
|
|
||||||
export class HttpClient<SecurityDataType = unknown> {
|
|
||||||
public baseUrl: string = "";
|
|
||||||
private securityData: SecurityDataType = null as any;
|
|
||||||
private securityWorker: null | ApiConfig<SecurityDataType>["securityWorker"] = null;
|
|
||||||
private abortControllers = new Map<CancelToken, AbortController>();
|
|
||||||
|
|
||||||
private baseApiParams: RequestParams = {
|
|
||||||
credentials: "same-origin",
|
|
||||||
headers: {},
|
|
||||||
redirect: "follow",
|
|
||||||
referrerPolicy: "no-referrer",
|
|
||||||
};
|
|
||||||
|
|
||||||
constructor(apiConfig: ApiConfig<SecurityDataType> = {}) {
|
|
||||||
Object.assign(this, apiConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
public setSecurityData = (data: SecurityDataType) => {
|
|
||||||
this.securityData = data;
|
|
||||||
};
|
|
||||||
|
|
||||||
private addQueryParam(query: QueryParamsType, key: string) {
|
|
||||||
const value = query[key];
|
|
||||||
|
|
||||||
return (
|
|
||||||
encodeURIComponent(key) +
|
|
||||||
"=" +
|
|
||||||
encodeURIComponent(Array.isArray(value) ? value.join(",") : typeof value === "number" ? value : `${value}`)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected toQueryString(rawQuery?: QueryParamsType): string {
|
|
||||||
const query = rawQuery || {};
|
|
||||||
const keys = Object.keys(query).filter((key) => "undefined" !== typeof query[key]);
|
|
||||||
return keys
|
|
||||||
.map((key) =>
|
|
||||||
typeof query[key] === "object" && !Array.isArray(query[key])
|
|
||||||
? this.toQueryString(query[key] as QueryParamsType)
|
|
||||||
: this.addQueryParam(query, key),
|
|
||||||
)
|
|
||||||
.join("&");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected addQueryParams(rawQuery?: QueryParamsType): string {
|
|
||||||
const queryString = this.toQueryString(rawQuery);
|
|
||||||
return queryString ? `?${queryString}` : "";
|
|
||||||
}
|
|
||||||
|
|
||||||
private contentFormatters: Record<ContentType, (input: any) => any> = {
|
|
||||||
[ContentType.Json]: (input: any) =>
|
|
||||||
input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input,
|
|
||||||
[ContentType.FormData]: (input: any) =>
|
|
||||||
Object.keys(input || {}).reduce((data, key) => {
|
|
||||||
data.append(key, input[key]);
|
|
||||||
return data;
|
|
||||||
}, new FormData()),
|
|
||||||
[ContentType.UrlEncoded]: (input: any) => this.toQueryString(input),
|
|
||||||
};
|
|
||||||
|
|
||||||
private mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams {
|
|
||||||
return {
|
|
||||||
...this.baseApiParams,
|
|
||||||
...params1,
|
|
||||||
...(params2 || {}),
|
|
||||||
headers: {
|
|
||||||
...(this.baseApiParams.headers || {}),
|
|
||||||
...(params1.headers || {}),
|
|
||||||
...((params2 && params2.headers) || {}),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private createAbortSignal = (cancelToken: CancelToken): AbortSignal | undefined => {
|
|
||||||
if (this.abortControllers.has(cancelToken)) {
|
|
||||||
const abortController = this.abortControllers.get(cancelToken);
|
|
||||||
if (abortController) {
|
|
||||||
return abortController.signal;
|
|
||||||
}
|
|
||||||
return void 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const abortController = new AbortController();
|
|
||||||
this.abortControllers.set(cancelToken, abortController);
|
|
||||||
return abortController.signal;
|
|
||||||
};
|
|
||||||
|
|
||||||
public abortRequest = (cancelToken: CancelToken) => {
|
|
||||||
const abortController = this.abortControllers.get(cancelToken);
|
|
||||||
|
|
||||||
if (abortController) {
|
|
||||||
abortController.abort();
|
|
||||||
this.abortControllers.delete(cancelToken);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public request = <T = any, E = any>({
|
|
||||||
body,
|
|
||||||
secure,
|
|
||||||
path,
|
|
||||||
type,
|
|
||||||
query,
|
|
||||||
format = "json",
|
|
||||||
baseUrl,
|
|
||||||
cancelToken,
|
|
||||||
...params
|
|
||||||
}: FullRequestParams): Promise<HttpResponse<T, E>> => {
|
|
||||||
const secureParams = (secure && this.securityWorker && this.securityWorker(this.securityData)) || {};
|
|
||||||
const requestParams = this.mergeRequestParams(params, secureParams);
|
|
||||||
const queryString = query && this.toQueryString(query);
|
|
||||||
const payloadFormatter = this.contentFormatters[type || ContentType.Json];
|
|
||||||
|
|
||||||
return fetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, {
|
|
||||||
...requestParams,
|
|
||||||
headers: {
|
|
||||||
...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}),
|
|
||||||
...(requestParams.headers || {}),
|
|
||||||
},
|
|
||||||
signal: cancelToken ? this.createAbortSignal(cancelToken) : void 0,
|
|
||||||
body: typeof body === "undefined" || body === null ? null : payloadFormatter(body),
|
|
||||||
}).then(async (response) => {
|
|
||||||
const r = response as HttpResponse<T, E>;
|
|
||||||
r.data = (null as unknown) as T;
|
|
||||||
r.error = (null as unknown) as E;
|
|
||||||
|
|
||||||
const data = await response[format]()
|
|
||||||
.then((data) => {
|
|
||||||
if (r.ok) {
|
|
||||||
r.data = data;
|
|
||||||
} else {
|
|
||||||
r.error = data;
|
|
||||||
}
|
|
||||||
return r;
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
r.error = e;
|
|
||||||
return r;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (cancelToken) {
|
|
||||||
this.abortControllers.delete(cancelToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!response.ok) throw data;
|
|
||||||
return data;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @title cosmos/base/tendermint/v1beta1/query.proto
|
|
||||||
* @version version not set
|
|
||||||
*/
|
|
||||||
export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
|
|
||||||
/**
|
|
||||||
* No description
|
|
||||||
*
|
|
||||||
* @tags Service
|
|
||||||
* @name ServiceGetLatestBlock
|
|
||||||
* @summary GetLatestBlock returns the latest block.
|
|
||||||
* @request GET:/cosmos/base/tendermint/v1beta1/blocks/latest
|
|
||||||
*/
|
|
||||||
serviceGetLatestBlock = (params: RequestParams = {}) =>
|
|
||||||
this.request<V1Beta1GetLatestBlockResponse, RpcStatus>({
|
|
||||||
path: `/cosmos/base/tendermint/v1beta1/blocks/latest`,
|
|
||||||
method: "GET",
|
|
||||||
format: "json",
|
|
||||||
...params,
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* No description
|
|
||||||
*
|
|
||||||
* @tags Service
|
|
||||||
* @name ServiceGetBlockByHeight
|
|
||||||
* @summary GetBlockByHeight queries block for given height.
|
|
||||||
* @request GET:/cosmos/base/tendermint/v1beta1/blocks/{height}
|
|
||||||
*/
|
|
||||||
serviceGetBlockByHeight = (height: string, params: RequestParams = {}) =>
|
|
||||||
this.request<V1Beta1GetBlockByHeightResponse, RpcStatus>({
|
|
||||||
path: `/cosmos/base/tendermint/v1beta1/blocks/${height}`,
|
|
||||||
method: "GET",
|
|
||||||
format: "json",
|
|
||||||
...params,
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* No description
|
|
||||||
*
|
|
||||||
* @tags Service
|
|
||||||
* @name ServiceGetNodeInfo
|
|
||||||
* @summary GetNodeInfo queries the current node info.
|
|
||||||
* @request GET:/cosmos/base/tendermint/v1beta1/node_info
|
|
||||||
*/
|
|
||||||
serviceGetNodeInfo = (params: RequestParams = {}) =>
|
|
||||||
this.request<V1Beta1GetNodeInfoResponse, RpcStatus>({
|
|
||||||
path: `/cosmos/base/tendermint/v1beta1/node_info`,
|
|
||||||
method: "GET",
|
|
||||||
format: "json",
|
|
||||||
...params,
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* No description
|
|
||||||
*
|
|
||||||
* @tags Service
|
|
||||||
* @name ServiceGetSyncing
|
|
||||||
* @summary GetSyncing queries node syncing.
|
|
||||||
* @request GET:/cosmos/base/tendermint/v1beta1/syncing
|
|
||||||
*/
|
|
||||||
serviceGetSyncing = (params: RequestParams = {}) =>
|
|
||||||
this.request<V1Beta1GetSyncingResponse, RpcStatus>({
|
|
||||||
path: `/cosmos/base/tendermint/v1beta1/syncing`,
|
|
||||||
method: "GET",
|
|
||||||
format: "json",
|
|
||||||
...params,
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* No description
|
|
||||||
*
|
|
||||||
* @tags Service
|
|
||||||
* @name ServiceGetLatestValidatorSet
|
|
||||||
* @summary GetLatestValidatorSet queries latest validator-set.
|
|
||||||
* @request GET:/cosmos/base/tendermint/v1beta1/validatorsets/latest
|
|
||||||
*/
|
|
||||||
serviceGetLatestValidatorSet = (
|
|
||||||
query?: {
|
|
||||||
"pagination.key"?: string;
|
|
||||||
"pagination.offset"?: string;
|
|
||||||
"pagination.limit"?: string;
|
|
||||||
"pagination.count_total"?: boolean;
|
|
||||||
"pagination.reverse"?: boolean;
|
|
||||||
},
|
|
||||||
params: RequestParams = {},
|
|
||||||
) =>
|
|
||||||
this.request<V1Beta1GetLatestValidatorSetResponse, RpcStatus>({
|
|
||||||
path: `/cosmos/base/tendermint/v1beta1/validatorsets/latest`,
|
|
||||||
method: "GET",
|
|
||||||
query: query,
|
|
||||||
format: "json",
|
|
||||||
...params,
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* No description
|
|
||||||
*
|
|
||||||
* @tags Service
|
|
||||||
* @name ServiceGetValidatorSetByHeight
|
|
||||||
* @summary GetValidatorSetByHeight queries validator-set at a given height.
|
|
||||||
* @request GET:/cosmos/base/tendermint/v1beta1/validatorsets/{height}
|
|
||||||
*/
|
|
||||||
serviceGetValidatorSetByHeight = (
|
|
||||||
height: string,
|
|
||||||
query?: {
|
|
||||||
"pagination.key"?: string;
|
|
||||||
"pagination.offset"?: string;
|
|
||||||
"pagination.limit"?: string;
|
|
||||||
"pagination.count_total"?: boolean;
|
|
||||||
"pagination.reverse"?: boolean;
|
|
||||||
},
|
|
||||||
params: RequestParams = {},
|
|
||||||
) =>
|
|
||||||
this.request<V1Beta1GetValidatorSetByHeightResponse, RpcStatus>({
|
|
||||||
path: `/cosmos/base/tendermint/v1beta1/validatorsets/${height}`,
|
|
||||||
method: "GET",
|
|
||||||
query: query,
|
|
||||||
format: "json",
|
|
||||||
...params,
|
|
||||||
});
|
|
||||||
}
|
|
|
@ -1,328 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import * as Long from "long";
|
|
||||||
import { util, configure, Writer, Reader } from "protobufjs/minimal";
|
|
||||||
|
|
||||||
export const protobufPackage = "cosmos.base.query.v1beta1";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PageRequest is to be embedded in gRPC request messages for efficient
|
|
||||||
* pagination. Ex:
|
|
||||||
*
|
|
||||||
* message SomeRequest {
|
|
||||||
* Foo some_parameter = 1;
|
|
||||||
* PageRequest pagination = 2;
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
export interface PageRequest {
|
|
||||||
/**
|
|
||||||
* key is a value returned in PageResponse.next_key to begin
|
|
||||||
* querying the next page most efficiently. Only one of offset or key
|
|
||||||
* should be set.
|
|
||||||
*/
|
|
||||||
key: Uint8Array;
|
|
||||||
/**
|
|
||||||
* offset is a numeric offset that can be used when key is unavailable.
|
|
||||||
* It is less efficient than using key. Only one of offset or key should
|
|
||||||
* be set.
|
|
||||||
*/
|
|
||||||
offset: number;
|
|
||||||
/**
|
|
||||||
* limit is the total number of results to be returned in the result page.
|
|
||||||
* If left empty it will default to a value to be set by each app.
|
|
||||||
*/
|
|
||||||
limit: number;
|
|
||||||
/**
|
|
||||||
* count_total is set to true to indicate that the result set should include
|
|
||||||
* a count of the total number of items available for pagination in UIs.
|
|
||||||
* count_total is only respected when offset is used. It is ignored when key
|
|
||||||
* is set.
|
|
||||||
*/
|
|
||||||
count_total: boolean;
|
|
||||||
/**
|
|
||||||
* reverse is set to true if results are to be returned in the descending order.
|
|
||||||
*
|
|
||||||
* Since: cosmos-sdk 0.43
|
|
||||||
*/
|
|
||||||
reverse: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PageResponse is to be embedded in gRPC response messages where the
|
|
||||||
* corresponding request message has used PageRequest.
|
|
||||||
*
|
|
||||||
* message SomeResponse {
|
|
||||||
* repeated Bar results = 1;
|
|
||||||
* PageResponse page = 2;
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
export interface PageResponse {
|
|
||||||
/**
|
|
||||||
* next_key is the key to be passed to PageRequest.key to
|
|
||||||
* query the next page most efficiently
|
|
||||||
*/
|
|
||||||
next_key: Uint8Array;
|
|
||||||
/**
|
|
||||||
* total is total number of results available if PageRequest.count_total
|
|
||||||
* was set, its value is undefined otherwise
|
|
||||||
*/
|
|
||||||
total: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
const basePageRequest: object = {
|
|
||||||
offset: 0,
|
|
||||||
limit: 0,
|
|
||||||
count_total: false,
|
|
||||||
reverse: false,
|
|
||||||
};
|
|
||||||
|
|
||||||
export const PageRequest = {
|
|
||||||
encode(message: PageRequest, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.key.length !== 0) {
|
|
||||||
writer.uint32(10).bytes(message.key);
|
|
||||||
}
|
|
||||||
if (message.offset !== 0) {
|
|
||||||
writer.uint32(16).uint64(message.offset);
|
|
||||||
}
|
|
||||||
if (message.limit !== 0) {
|
|
||||||
writer.uint32(24).uint64(message.limit);
|
|
||||||
}
|
|
||||||
if (message.count_total === true) {
|
|
||||||
writer.uint32(32).bool(message.count_total);
|
|
||||||
}
|
|
||||||
if (message.reverse === true) {
|
|
||||||
writer.uint32(40).bool(message.reverse);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): PageRequest {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...basePageRequest } as PageRequest;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.key = reader.bytes();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.offset = longToNumber(reader.uint64() as Long);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
message.limit = longToNumber(reader.uint64() as Long);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
message.count_total = reader.bool();
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
message.reverse = reader.bool();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): PageRequest {
|
|
||||||
const message = { ...basePageRequest } as PageRequest;
|
|
||||||
if (object.key !== undefined && object.key !== null) {
|
|
||||||
message.key = bytesFromBase64(object.key);
|
|
||||||
}
|
|
||||||
if (object.offset !== undefined && object.offset !== null) {
|
|
||||||
message.offset = Number(object.offset);
|
|
||||||
} else {
|
|
||||||
message.offset = 0;
|
|
||||||
}
|
|
||||||
if (object.limit !== undefined && object.limit !== null) {
|
|
||||||
message.limit = Number(object.limit);
|
|
||||||
} else {
|
|
||||||
message.limit = 0;
|
|
||||||
}
|
|
||||||
if (object.count_total !== undefined && object.count_total !== null) {
|
|
||||||
message.count_total = Boolean(object.count_total);
|
|
||||||
} else {
|
|
||||||
message.count_total = false;
|
|
||||||
}
|
|
||||||
if (object.reverse !== undefined && object.reverse !== null) {
|
|
||||||
message.reverse = Boolean(object.reverse);
|
|
||||||
} else {
|
|
||||||
message.reverse = false;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: PageRequest): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.key !== undefined &&
|
|
||||||
(obj.key = base64FromBytes(
|
|
||||||
message.key !== undefined ? message.key : new Uint8Array()
|
|
||||||
));
|
|
||||||
message.offset !== undefined && (obj.offset = message.offset);
|
|
||||||
message.limit !== undefined && (obj.limit = message.limit);
|
|
||||||
message.count_total !== undefined &&
|
|
||||||
(obj.count_total = message.count_total);
|
|
||||||
message.reverse !== undefined && (obj.reverse = message.reverse);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<PageRequest>): PageRequest {
|
|
||||||
const message = { ...basePageRequest } as PageRequest;
|
|
||||||
if (object.key !== undefined && object.key !== null) {
|
|
||||||
message.key = object.key;
|
|
||||||
} else {
|
|
||||||
message.key = new Uint8Array();
|
|
||||||
}
|
|
||||||
if (object.offset !== undefined && object.offset !== null) {
|
|
||||||
message.offset = object.offset;
|
|
||||||
} else {
|
|
||||||
message.offset = 0;
|
|
||||||
}
|
|
||||||
if (object.limit !== undefined && object.limit !== null) {
|
|
||||||
message.limit = object.limit;
|
|
||||||
} else {
|
|
||||||
message.limit = 0;
|
|
||||||
}
|
|
||||||
if (object.count_total !== undefined && object.count_total !== null) {
|
|
||||||
message.count_total = object.count_total;
|
|
||||||
} else {
|
|
||||||
message.count_total = false;
|
|
||||||
}
|
|
||||||
if (object.reverse !== undefined && object.reverse !== null) {
|
|
||||||
message.reverse = object.reverse;
|
|
||||||
} else {
|
|
||||||
message.reverse = false;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const basePageResponse: object = { total: 0 };
|
|
||||||
|
|
||||||
export const PageResponse = {
|
|
||||||
encode(message: PageResponse, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.next_key.length !== 0) {
|
|
||||||
writer.uint32(10).bytes(message.next_key);
|
|
||||||
}
|
|
||||||
if (message.total !== 0) {
|
|
||||||
writer.uint32(16).uint64(message.total);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): PageResponse {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...basePageResponse } as PageResponse;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.next_key = reader.bytes();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.total = longToNumber(reader.uint64() as Long);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): PageResponse {
|
|
||||||
const message = { ...basePageResponse } as PageResponse;
|
|
||||||
if (object.next_key !== undefined && object.next_key !== null) {
|
|
||||||
message.next_key = bytesFromBase64(object.next_key);
|
|
||||||
}
|
|
||||||
if (object.total !== undefined && object.total !== null) {
|
|
||||||
message.total = Number(object.total);
|
|
||||||
} else {
|
|
||||||
message.total = 0;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: PageResponse): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.next_key !== undefined &&
|
|
||||||
(obj.next_key = base64FromBytes(
|
|
||||||
message.next_key !== undefined ? message.next_key : new Uint8Array()
|
|
||||||
));
|
|
||||||
message.total !== undefined && (obj.total = message.total);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<PageResponse>): PageResponse {
|
|
||||||
const message = { ...basePageResponse } as PageResponse;
|
|
||||||
if (object.next_key !== undefined && object.next_key !== null) {
|
|
||||||
message.next_key = object.next_key;
|
|
||||||
} else {
|
|
||||||
message.next_key = new Uint8Array();
|
|
||||||
}
|
|
||||||
if (object.total !== undefined && object.total !== null) {
|
|
||||||
message.total = object.total;
|
|
||||||
} else {
|
|
||||||
message.total = 0;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
declare var self: any | undefined;
|
|
||||||
declare var window: any | undefined;
|
|
||||||
var globalThis: any = (() => {
|
|
||||||
if (typeof globalThis !== "undefined") return globalThis;
|
|
||||||
if (typeof self !== "undefined") return self;
|
|
||||||
if (typeof window !== "undefined") return window;
|
|
||||||
if (typeof global !== "undefined") return global;
|
|
||||||
throw "Unable to locate global object";
|
|
||||||
})();
|
|
||||||
|
|
||||||
const atob: (b64: string) => string =
|
|
||||||
globalThis.atob ||
|
|
||||||
((b64) => globalThis.Buffer.from(b64, "base64").toString("binary"));
|
|
||||||
function bytesFromBase64(b64: string): Uint8Array {
|
|
||||||
const bin = atob(b64);
|
|
||||||
const arr = new Uint8Array(bin.length);
|
|
||||||
for (let i = 0; i < bin.length; ++i) {
|
|
||||||
arr[i] = bin.charCodeAt(i);
|
|
||||||
}
|
|
||||||
return arr;
|
|
||||||
}
|
|
||||||
|
|
||||||
const btoa: (bin: string) => string =
|
|
||||||
globalThis.btoa ||
|
|
||||||
((bin) => globalThis.Buffer.from(bin, "binary").toString("base64"));
|
|
||||||
function base64FromBytes(arr: Uint8Array): string {
|
|
||||||
const bin: string[] = [];
|
|
||||||
for (let i = 0; i < arr.byteLength; ++i) {
|
|
||||||
bin.push(String.fromCharCode(arr[i]));
|
|
||||||
}
|
|
||||||
return btoa(bin.join(""));
|
|
||||||
}
|
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
||||||
export type DeepPartial<T> = T extends Builtin
|
|
||||||
? T
|
|
||||||
: T extends Array<infer U>
|
|
||||||
? Array<DeepPartial<U>>
|
|
||||||
: T extends ReadonlyArray<infer U>
|
|
||||||
? ReadonlyArray<DeepPartial<U>>
|
|
||||||
: T extends {}
|
|
||||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
||||||
: Partial<T>;
|
|
||||||
|
|
||||||
function longToNumber(long: Long): number {
|
|
||||||
if (long.gt(Number.MAX_SAFE_INTEGER)) {
|
|
||||||
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
|
||||||
}
|
|
||||||
return long.toNumber();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (util.Long !== Long) {
|
|
||||||
util.Long = Long as any;
|
|
||||||
configure();
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,2 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
export const protobufPackage = "gogoproto";
|
|
|
@ -1,2 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
export const protobufPackage = "google.api";
|
|
|
@ -1,706 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import { Writer, Reader } from "protobufjs/minimal";
|
|
||||||
|
|
||||||
export const protobufPackage = "google.api";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Defines the HTTP configuration for an API service. It contains a list of
|
|
||||||
* [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method
|
|
||||||
* to one or more HTTP REST API methods.
|
|
||||||
*/
|
|
||||||
export interface Http {
|
|
||||||
/**
|
|
||||||
* A list of HTTP configuration rules that apply to individual API methods.
|
|
||||||
*
|
|
||||||
* **NOTE:** All service configuration rules follow "last one wins" order.
|
|
||||||
*/
|
|
||||||
rules: HttpRule[];
|
|
||||||
/**
|
|
||||||
* When set to true, URL path parmeters will be fully URI-decoded except in
|
|
||||||
* cases of single segment matches in reserved expansion, where "%2F" will be
|
|
||||||
* left encoded.
|
|
||||||
*
|
|
||||||
* The default behavior is to not decode RFC 6570 reserved characters in multi
|
|
||||||
* segment matches.
|
|
||||||
*/
|
|
||||||
fully_decode_reserved_expansion: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* `HttpRule` defines the mapping of an RPC method to one or more HTTP
|
|
||||||
* REST API methods. The mapping specifies how different portions of the RPC
|
|
||||||
* request message are mapped to URL path, URL query parameters, and
|
|
||||||
* HTTP request body. The mapping is typically specified as an
|
|
||||||
* `google.api.http` annotation on the RPC method,
|
|
||||||
* see "google/api/annotations.proto" for details.
|
|
||||||
*
|
|
||||||
* The mapping consists of a field specifying the path template and
|
|
||||||
* method kind. The path template can refer to fields in the request
|
|
||||||
* message, as in the example below which describes a REST GET
|
|
||||||
* operation on a resource collection of messages:
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* service Messaging {
|
|
||||||
* rpc GetMessage(GetMessageRequest) returns (Message) {
|
|
||||||
* option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}";
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* message GetMessageRequest {
|
|
||||||
* message SubMessage {
|
|
||||||
* string subfield = 1;
|
|
||||||
* }
|
|
||||||
* string message_id = 1; // mapped to the URL
|
|
||||||
* SubMessage sub = 2; // `sub.subfield` is url-mapped
|
|
||||||
* }
|
|
||||||
* message Message {
|
|
||||||
* string text = 1; // content of the resource
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* The same http annotation can alternatively be expressed inside the
|
|
||||||
* `GRPC API Configuration` YAML file.
|
|
||||||
*
|
|
||||||
* http:
|
|
||||||
* rules:
|
|
||||||
* - selector: <proto_package_name>.Messaging.GetMessage
|
|
||||||
* get: /v1/messages/{message_id}/{sub.subfield}
|
|
||||||
*
|
|
||||||
* This definition enables an automatic, bidrectional mapping of HTTP
|
|
||||||
* JSON to RPC. Example:
|
|
||||||
*
|
|
||||||
* HTTP | RPC
|
|
||||||
* -----|-----
|
|
||||||
* `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))`
|
|
||||||
*
|
|
||||||
* In general, not only fields but also field paths can be referenced
|
|
||||||
* from a path pattern. Fields mapped to the path pattern cannot be
|
|
||||||
* repeated and must have a primitive (non-message) type.
|
|
||||||
*
|
|
||||||
* Any fields in the request message which are not bound by the path
|
|
||||||
* pattern automatically become (optional) HTTP query
|
|
||||||
* parameters. Assume the following definition of the request message:
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* service Messaging {
|
|
||||||
* rpc GetMessage(GetMessageRequest) returns (Message) {
|
|
||||||
* option (google.api.http).get = "/v1/messages/{message_id}";
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* message GetMessageRequest {
|
|
||||||
* message SubMessage {
|
|
||||||
* string subfield = 1;
|
|
||||||
* }
|
|
||||||
* string message_id = 1; // mapped to the URL
|
|
||||||
* int64 revision = 2; // becomes a parameter
|
|
||||||
* SubMessage sub = 3; // `sub.subfield` becomes a parameter
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* This enables a HTTP JSON to RPC mapping as below:
|
|
||||||
*
|
|
||||||
* HTTP | RPC
|
|
||||||
* -----|-----
|
|
||||||
* `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))`
|
|
||||||
*
|
|
||||||
* Note that fields which are mapped to HTTP parameters must have a
|
|
||||||
* primitive type or a repeated primitive type. Message types are not
|
|
||||||
* allowed. In the case of a repeated type, the parameter can be
|
|
||||||
* repeated in the URL, as in `...?param=A¶m=B`.
|
|
||||||
*
|
|
||||||
* For HTTP method kinds which allow a request body, the `body` field
|
|
||||||
* specifies the mapping. Consider a REST update method on the
|
|
||||||
* message resource collection:
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* service Messaging {
|
|
||||||
* rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
|
|
||||||
* option (google.api.http) = {
|
|
||||||
* put: "/v1/messages/{message_id}"
|
|
||||||
* body: "message"
|
|
||||||
* };
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* message UpdateMessageRequest {
|
|
||||||
* string message_id = 1; // mapped to the URL
|
|
||||||
* Message message = 2; // mapped to the body
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* The following HTTP JSON to RPC mapping is enabled, where the
|
|
||||||
* representation of the JSON in the request body is determined by
|
|
||||||
* protos JSON encoding:
|
|
||||||
*
|
|
||||||
* HTTP | RPC
|
|
||||||
* -----|-----
|
|
||||||
* `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })`
|
|
||||||
*
|
|
||||||
* The special name `*` can be used in the body mapping to define that
|
|
||||||
* every field not bound by the path template should be mapped to the
|
|
||||||
* request body. This enables the following alternative definition of
|
|
||||||
* the update method:
|
|
||||||
*
|
|
||||||
* service Messaging {
|
|
||||||
* rpc UpdateMessage(Message) returns (Message) {
|
|
||||||
* option (google.api.http) = {
|
|
||||||
* put: "/v1/messages/{message_id}"
|
|
||||||
* body: "*"
|
|
||||||
* };
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* message Message {
|
|
||||||
* string message_id = 1;
|
|
||||||
* string text = 2;
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* The following HTTP JSON to RPC mapping is enabled:
|
|
||||||
*
|
|
||||||
* HTTP | RPC
|
|
||||||
* -----|-----
|
|
||||||
* `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")`
|
|
||||||
*
|
|
||||||
* Note that when using `*` in the body mapping, it is not possible to
|
|
||||||
* have HTTP parameters, as all fields not bound by the path end in
|
|
||||||
* the body. This makes this option more rarely used in practice of
|
|
||||||
* defining REST APIs. The common usage of `*` is in custom methods
|
|
||||||
* which don't use the URL at all for transferring data.
|
|
||||||
*
|
|
||||||
* It is possible to define multiple HTTP methods for one RPC by using
|
|
||||||
* the `additional_bindings` option. Example:
|
|
||||||
*
|
|
||||||
* service Messaging {
|
|
||||||
* rpc GetMessage(GetMessageRequest) returns (Message) {
|
|
||||||
* option (google.api.http) = {
|
|
||||||
* get: "/v1/messages/{message_id}"
|
|
||||||
* additional_bindings {
|
|
||||||
* get: "/v1/users/{user_id}/messages/{message_id}"
|
|
||||||
* }
|
|
||||||
* };
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* message GetMessageRequest {
|
|
||||||
* string message_id = 1;
|
|
||||||
* string user_id = 2;
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* This enables the following two alternative HTTP JSON to RPC
|
|
||||||
* mappings:
|
|
||||||
*
|
|
||||||
* HTTP | RPC
|
|
||||||
* -----|-----
|
|
||||||
* `GET /v1/messages/123456` | `GetMessage(message_id: "123456")`
|
|
||||||
* `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")`
|
|
||||||
*
|
|
||||||
* # Rules for HTTP mapping
|
|
||||||
*
|
|
||||||
* The rules for mapping HTTP path, query parameters, and body fields
|
|
||||||
* to the request message are as follows:
|
|
||||||
*
|
|
||||||
* 1. The `body` field specifies either `*` or a field path, or is
|
|
||||||
* omitted. If omitted, it indicates there is no HTTP request body.
|
|
||||||
* 2. Leaf fields (recursive expansion of nested messages in the
|
|
||||||
* request) can be classified into three types:
|
|
||||||
* (a) Matched in the URL template.
|
|
||||||
* (b) Covered by body (if body is `*`, everything except (a) fields;
|
|
||||||
* else everything under the body field)
|
|
||||||
* (c) All other fields.
|
|
||||||
* 3. URL query parameters found in the HTTP request are mapped to (c) fields.
|
|
||||||
* 4. Any body sent with an HTTP request can contain only (b) fields.
|
|
||||||
*
|
|
||||||
* The syntax of the path template is as follows:
|
|
||||||
*
|
|
||||||
* Template = "/" Segments [ Verb ] ;
|
|
||||||
* Segments = Segment { "/" Segment } ;
|
|
||||||
* Segment = "*" | "**" | LITERAL | Variable ;
|
|
||||||
* Variable = "{" FieldPath [ "=" Segments ] "}" ;
|
|
||||||
* FieldPath = IDENT { "." IDENT } ;
|
|
||||||
* Verb = ":" LITERAL ;
|
|
||||||
*
|
|
||||||
* The syntax `*` matches a single path segment. The syntax `**` matches zero
|
|
||||||
* or more path segments, which must be the last part of the path except the
|
|
||||||
* `Verb`. The syntax `LITERAL` matches literal text in the path.
|
|
||||||
*
|
|
||||||
* The syntax `Variable` matches part of the URL path as specified by its
|
|
||||||
* template. A variable template must not contain other variables. If a variable
|
|
||||||
* matches a single path segment, its template may be omitted, e.g. `{var}`
|
|
||||||
* is equivalent to `{var=*}`.
|
|
||||||
*
|
|
||||||
* If a variable contains exactly one path segment, such as `"{var}"` or
|
|
||||||
* `"{var=*}"`, when such a variable is expanded into a URL path, all characters
|
|
||||||
* except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the
|
|
||||||
* Discovery Document as `{var}`.
|
|
||||||
*
|
|
||||||
* If a variable contains one or more path segments, such as `"{var=foo/*}"`
|
|
||||||
* or `"{var=**}"`, when such a variable is expanded into a URL path, all
|
|
||||||
* characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables
|
|
||||||
* show up in the Discovery Document as `{+var}`.
|
|
||||||
*
|
|
||||||
* NOTE: While the single segment variable matches the semantics of
|
|
||||||
* [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2
|
|
||||||
* Simple String Expansion, the multi segment variable **does not** match
|
|
||||||
* RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion
|
|
||||||
* does not expand special characters like `?` and `#`, which would lead
|
|
||||||
* to invalid URLs.
|
|
||||||
*
|
|
||||||
* NOTE: the field paths in variables and in the `body` must not refer to
|
|
||||||
* repeated fields or map fields.
|
|
||||||
*/
|
|
||||||
export interface HttpRule {
|
|
||||||
/**
|
|
||||||
* Selects methods to which this rule applies.
|
|
||||||
*
|
|
||||||
* Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
|
|
||||||
*/
|
|
||||||
selector: string;
|
|
||||||
/** Used for listing and getting information about resources. */
|
|
||||||
get: string | undefined;
|
|
||||||
/** Used for updating a resource. */
|
|
||||||
put: string | undefined;
|
|
||||||
/** Used for creating a resource. */
|
|
||||||
post: string | undefined;
|
|
||||||
/** Used for deleting a resource. */
|
|
||||||
delete: string | undefined;
|
|
||||||
/** Used for updating a resource. */
|
|
||||||
patch: string | undefined;
|
|
||||||
/**
|
|
||||||
* The custom pattern is used for specifying an HTTP method that is not
|
|
||||||
* included in the `pattern` field, such as HEAD, or "*" to leave the
|
|
||||||
* HTTP method unspecified for this rule. The wild-card rule is useful
|
|
||||||
* for services that provide content to Web (HTML) clients.
|
|
||||||
*/
|
|
||||||
custom: CustomHttpPattern | undefined;
|
|
||||||
/**
|
|
||||||
* The name of the request field whose value is mapped to the HTTP body, or
|
|
||||||
* `*` for mapping all fields not captured by the path pattern to the HTTP
|
|
||||||
* body. NOTE: the referred field must not be a repeated field and must be
|
|
||||||
* present at the top-level of request message type.
|
|
||||||
*/
|
|
||||||
body: string;
|
|
||||||
/**
|
|
||||||
* Optional. The name of the response field whose value is mapped to the HTTP
|
|
||||||
* body of response. Other response fields are ignored. When
|
|
||||||
* not set, the response message will be used as HTTP body of response.
|
|
||||||
*/
|
|
||||||
response_body: string;
|
|
||||||
/**
|
|
||||||
* Additional HTTP bindings for the selector. Nested bindings must
|
|
||||||
* not contain an `additional_bindings` field themselves (that is,
|
|
||||||
* the nesting may only be one level deep).
|
|
||||||
*/
|
|
||||||
additional_bindings: HttpRule[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** A custom pattern is used for defining custom HTTP verb. */
|
|
||||||
export interface CustomHttpPattern {
|
|
||||||
/** The name of this custom HTTP verb. */
|
|
||||||
kind: string;
|
|
||||||
/** The path matched by this custom verb. */
|
|
||||||
path: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
const baseHttp: object = { fully_decode_reserved_expansion: false };
|
|
||||||
|
|
||||||
export const Http = {
|
|
||||||
encode(message: Http, writer: Writer = Writer.create()): Writer {
|
|
||||||
for (const v of message.rules) {
|
|
||||||
HttpRule.encode(v!, writer.uint32(10).fork()).ldelim();
|
|
||||||
}
|
|
||||||
if (message.fully_decode_reserved_expansion === true) {
|
|
||||||
writer.uint32(16).bool(message.fully_decode_reserved_expansion);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): Http {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseHttp } as Http;
|
|
||||||
message.rules = [];
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.rules.push(HttpRule.decode(reader, reader.uint32()));
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.fully_decode_reserved_expansion = reader.bool();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): Http {
|
|
||||||
const message = { ...baseHttp } as Http;
|
|
||||||
message.rules = [];
|
|
||||||
if (object.rules !== undefined && object.rules !== null) {
|
|
||||||
for (const e of object.rules) {
|
|
||||||
message.rules.push(HttpRule.fromJSON(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.fully_decode_reserved_expansion !== undefined &&
|
|
||||||
object.fully_decode_reserved_expansion !== null
|
|
||||||
) {
|
|
||||||
message.fully_decode_reserved_expansion = Boolean(
|
|
||||||
object.fully_decode_reserved_expansion
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
message.fully_decode_reserved_expansion = false;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: Http): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
if (message.rules) {
|
|
||||||
obj.rules = message.rules.map((e) =>
|
|
||||||
e ? HttpRule.toJSON(e) : undefined
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
obj.rules = [];
|
|
||||||
}
|
|
||||||
message.fully_decode_reserved_expansion !== undefined &&
|
|
||||||
(obj.fully_decode_reserved_expansion =
|
|
||||||
message.fully_decode_reserved_expansion);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<Http>): Http {
|
|
||||||
const message = { ...baseHttp } as Http;
|
|
||||||
message.rules = [];
|
|
||||||
if (object.rules !== undefined && object.rules !== null) {
|
|
||||||
for (const e of object.rules) {
|
|
||||||
message.rules.push(HttpRule.fromPartial(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.fully_decode_reserved_expansion !== undefined &&
|
|
||||||
object.fully_decode_reserved_expansion !== null
|
|
||||||
) {
|
|
||||||
message.fully_decode_reserved_expansion =
|
|
||||||
object.fully_decode_reserved_expansion;
|
|
||||||
} else {
|
|
||||||
message.fully_decode_reserved_expansion = false;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseHttpRule: object = { selector: "", body: "", response_body: "" };
|
|
||||||
|
|
||||||
export const HttpRule = {
|
|
||||||
encode(message: HttpRule, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.selector !== "") {
|
|
||||||
writer.uint32(10).string(message.selector);
|
|
||||||
}
|
|
||||||
if (message.get !== undefined) {
|
|
||||||
writer.uint32(18).string(message.get);
|
|
||||||
}
|
|
||||||
if (message.put !== undefined) {
|
|
||||||
writer.uint32(26).string(message.put);
|
|
||||||
}
|
|
||||||
if (message.post !== undefined) {
|
|
||||||
writer.uint32(34).string(message.post);
|
|
||||||
}
|
|
||||||
if (message.delete !== undefined) {
|
|
||||||
writer.uint32(42).string(message.delete);
|
|
||||||
}
|
|
||||||
if (message.patch !== undefined) {
|
|
||||||
writer.uint32(50).string(message.patch);
|
|
||||||
}
|
|
||||||
if (message.custom !== undefined) {
|
|
||||||
CustomHttpPattern.encode(
|
|
||||||
message.custom,
|
|
||||||
writer.uint32(66).fork()
|
|
||||||
).ldelim();
|
|
||||||
}
|
|
||||||
if (message.body !== "") {
|
|
||||||
writer.uint32(58).string(message.body);
|
|
||||||
}
|
|
||||||
if (message.response_body !== "") {
|
|
||||||
writer.uint32(98).string(message.response_body);
|
|
||||||
}
|
|
||||||
for (const v of message.additional_bindings) {
|
|
||||||
HttpRule.encode(v!, writer.uint32(90).fork()).ldelim();
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): HttpRule {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseHttpRule } as HttpRule;
|
|
||||||
message.additional_bindings = [];
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.selector = reader.string();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.get = reader.string();
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
message.put = reader.string();
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
message.post = reader.string();
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
message.delete = reader.string();
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
message.patch = reader.string();
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
message.custom = CustomHttpPattern.decode(reader, reader.uint32());
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
message.body = reader.string();
|
|
||||||
break;
|
|
||||||
case 12:
|
|
||||||
message.response_body = reader.string();
|
|
||||||
break;
|
|
||||||
case 11:
|
|
||||||
message.additional_bindings.push(
|
|
||||||
HttpRule.decode(reader, reader.uint32())
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): HttpRule {
|
|
||||||
const message = { ...baseHttpRule } as HttpRule;
|
|
||||||
message.additional_bindings = [];
|
|
||||||
if (object.selector !== undefined && object.selector !== null) {
|
|
||||||
message.selector = String(object.selector);
|
|
||||||
} else {
|
|
||||||
message.selector = "";
|
|
||||||
}
|
|
||||||
if (object.get !== undefined && object.get !== null) {
|
|
||||||
message.get = String(object.get);
|
|
||||||
} else {
|
|
||||||
message.get = undefined;
|
|
||||||
}
|
|
||||||
if (object.put !== undefined && object.put !== null) {
|
|
||||||
message.put = String(object.put);
|
|
||||||
} else {
|
|
||||||
message.put = undefined;
|
|
||||||
}
|
|
||||||
if (object.post !== undefined && object.post !== null) {
|
|
||||||
message.post = String(object.post);
|
|
||||||
} else {
|
|
||||||
message.post = undefined;
|
|
||||||
}
|
|
||||||
if (object.delete !== undefined && object.delete !== null) {
|
|
||||||
message.delete = String(object.delete);
|
|
||||||
} else {
|
|
||||||
message.delete = undefined;
|
|
||||||
}
|
|
||||||
if (object.patch !== undefined && object.patch !== null) {
|
|
||||||
message.patch = String(object.patch);
|
|
||||||
} else {
|
|
||||||
message.patch = undefined;
|
|
||||||
}
|
|
||||||
if (object.custom !== undefined && object.custom !== null) {
|
|
||||||
message.custom = CustomHttpPattern.fromJSON(object.custom);
|
|
||||||
} else {
|
|
||||||
message.custom = undefined;
|
|
||||||
}
|
|
||||||
if (object.body !== undefined && object.body !== null) {
|
|
||||||
message.body = String(object.body);
|
|
||||||
} else {
|
|
||||||
message.body = "";
|
|
||||||
}
|
|
||||||
if (object.response_body !== undefined && object.response_body !== null) {
|
|
||||||
message.response_body = String(object.response_body);
|
|
||||||
} else {
|
|
||||||
message.response_body = "";
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.additional_bindings !== undefined &&
|
|
||||||
object.additional_bindings !== null
|
|
||||||
) {
|
|
||||||
for (const e of object.additional_bindings) {
|
|
||||||
message.additional_bindings.push(HttpRule.fromJSON(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: HttpRule): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.selector !== undefined && (obj.selector = message.selector);
|
|
||||||
message.get !== undefined && (obj.get = message.get);
|
|
||||||
message.put !== undefined && (obj.put = message.put);
|
|
||||||
message.post !== undefined && (obj.post = message.post);
|
|
||||||
message.delete !== undefined && (obj.delete = message.delete);
|
|
||||||
message.patch !== undefined && (obj.patch = message.patch);
|
|
||||||
message.custom !== undefined &&
|
|
||||||
(obj.custom = message.custom
|
|
||||||
? CustomHttpPattern.toJSON(message.custom)
|
|
||||||
: undefined);
|
|
||||||
message.body !== undefined && (obj.body = message.body);
|
|
||||||
message.response_body !== undefined &&
|
|
||||||
(obj.response_body = message.response_body);
|
|
||||||
if (message.additional_bindings) {
|
|
||||||
obj.additional_bindings = message.additional_bindings.map((e) =>
|
|
||||||
e ? HttpRule.toJSON(e) : undefined
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
obj.additional_bindings = [];
|
|
||||||
}
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<HttpRule>): HttpRule {
|
|
||||||
const message = { ...baseHttpRule } as HttpRule;
|
|
||||||
message.additional_bindings = [];
|
|
||||||
if (object.selector !== undefined && object.selector !== null) {
|
|
||||||
message.selector = object.selector;
|
|
||||||
} else {
|
|
||||||
message.selector = "";
|
|
||||||
}
|
|
||||||
if (object.get !== undefined && object.get !== null) {
|
|
||||||
message.get = object.get;
|
|
||||||
} else {
|
|
||||||
message.get = undefined;
|
|
||||||
}
|
|
||||||
if (object.put !== undefined && object.put !== null) {
|
|
||||||
message.put = object.put;
|
|
||||||
} else {
|
|
||||||
message.put = undefined;
|
|
||||||
}
|
|
||||||
if (object.post !== undefined && object.post !== null) {
|
|
||||||
message.post = object.post;
|
|
||||||
} else {
|
|
||||||
message.post = undefined;
|
|
||||||
}
|
|
||||||
if (object.delete !== undefined && object.delete !== null) {
|
|
||||||
message.delete = object.delete;
|
|
||||||
} else {
|
|
||||||
message.delete = undefined;
|
|
||||||
}
|
|
||||||
if (object.patch !== undefined && object.patch !== null) {
|
|
||||||
message.patch = object.patch;
|
|
||||||
} else {
|
|
||||||
message.patch = undefined;
|
|
||||||
}
|
|
||||||
if (object.custom !== undefined && object.custom !== null) {
|
|
||||||
message.custom = CustomHttpPattern.fromPartial(object.custom);
|
|
||||||
} else {
|
|
||||||
message.custom = undefined;
|
|
||||||
}
|
|
||||||
if (object.body !== undefined && object.body !== null) {
|
|
||||||
message.body = object.body;
|
|
||||||
} else {
|
|
||||||
message.body = "";
|
|
||||||
}
|
|
||||||
if (object.response_body !== undefined && object.response_body !== null) {
|
|
||||||
message.response_body = object.response_body;
|
|
||||||
} else {
|
|
||||||
message.response_body = "";
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.additional_bindings !== undefined &&
|
|
||||||
object.additional_bindings !== null
|
|
||||||
) {
|
|
||||||
for (const e of object.additional_bindings) {
|
|
||||||
message.additional_bindings.push(HttpRule.fromPartial(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseCustomHttpPattern: object = { kind: "", path: "" };
|
|
||||||
|
|
||||||
export const CustomHttpPattern = {
|
|
||||||
encode(message: CustomHttpPattern, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.kind !== "") {
|
|
||||||
writer.uint32(10).string(message.kind);
|
|
||||||
}
|
|
||||||
if (message.path !== "") {
|
|
||||||
writer.uint32(18).string(message.path);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): CustomHttpPattern {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseCustomHttpPattern } as CustomHttpPattern;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.kind = reader.string();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.path = reader.string();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): CustomHttpPattern {
|
|
||||||
const message = { ...baseCustomHttpPattern } as CustomHttpPattern;
|
|
||||||
if (object.kind !== undefined && object.kind !== null) {
|
|
||||||
message.kind = String(object.kind);
|
|
||||||
} else {
|
|
||||||
message.kind = "";
|
|
||||||
}
|
|
||||||
if (object.path !== undefined && object.path !== null) {
|
|
||||||
message.path = String(object.path);
|
|
||||||
} else {
|
|
||||||
message.path = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: CustomHttpPattern): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.kind !== undefined && (obj.kind = message.kind);
|
|
||||||
message.path !== undefined && (obj.path = message.path);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<CustomHttpPattern>): CustomHttpPattern {
|
|
||||||
const message = { ...baseCustomHttpPattern } as CustomHttpPattern;
|
|
||||||
if (object.kind !== undefined && object.kind !== null) {
|
|
||||||
message.kind = object.kind;
|
|
||||||
} else {
|
|
||||||
message.kind = "";
|
|
||||||
}
|
|
||||||
if (object.path !== undefined && object.path !== null) {
|
|
||||||
message.path = object.path;
|
|
||||||
} else {
|
|
||||||
message.path = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
||||||
export type DeepPartial<T> = T extends Builtin
|
|
||||||
? T
|
|
||||||
: T extends Array<infer U>
|
|
||||||
? Array<DeepPartial<U>>
|
|
||||||
: T extends ReadonlyArray<infer U>
|
|
||||||
? ReadonlyArray<DeepPartial<U>>
|
|
||||||
: T extends {}
|
|
||||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
||||||
: Partial<T>;
|
|
|
@ -1,240 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import { Writer, Reader } from "protobufjs/minimal";
|
|
||||||
|
|
||||||
export const protobufPackage = "google.protobuf";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* `Any` contains an arbitrary serialized protocol buffer message along with a
|
|
||||||
* URL that describes the type of the serialized message.
|
|
||||||
*
|
|
||||||
* Protobuf library provides support to pack/unpack Any values in the form
|
|
||||||
* of utility functions or additional generated methods of the Any type.
|
|
||||||
*
|
|
||||||
* Example 1: Pack and unpack a message in C++.
|
|
||||||
*
|
|
||||||
* Foo foo = ...;
|
|
||||||
* Any any;
|
|
||||||
* any.PackFrom(foo);
|
|
||||||
* ...
|
|
||||||
* if (any.UnpackTo(&foo)) {
|
|
||||||
* ...
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* Example 2: Pack and unpack a message in Java.
|
|
||||||
*
|
|
||||||
* Foo foo = ...;
|
|
||||||
* Any any = Any.pack(foo);
|
|
||||||
* ...
|
|
||||||
* if (any.is(Foo.class)) {
|
|
||||||
* foo = any.unpack(Foo.class);
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* Example 3: Pack and unpack a message in Python.
|
|
||||||
*
|
|
||||||
* foo = Foo(...)
|
|
||||||
* any = Any()
|
|
||||||
* any.Pack(foo)
|
|
||||||
* ...
|
|
||||||
* if any.Is(Foo.DESCRIPTOR):
|
|
||||||
* any.Unpack(foo)
|
|
||||||
* ...
|
|
||||||
*
|
|
||||||
* Example 4: Pack and unpack a message in Go
|
|
||||||
*
|
|
||||||
* foo := &pb.Foo{...}
|
|
||||||
* any, err := anypb.New(foo)
|
|
||||||
* if err != nil {
|
|
||||||
* ...
|
|
||||||
* }
|
|
||||||
* ...
|
|
||||||
* foo := &pb.Foo{}
|
|
||||||
* if err := any.UnmarshalTo(foo); err != nil {
|
|
||||||
* ...
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* The pack methods provided by protobuf library will by default use
|
|
||||||
* 'type.googleapis.com/full.type.name' as the type URL and the unpack
|
|
||||||
* methods only use the fully qualified type name after the last '/'
|
|
||||||
* in the type URL, for example "foo.bar.com/x/y.z" will yield type
|
|
||||||
* name "y.z".
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* JSON
|
|
||||||
* ====
|
|
||||||
* The JSON representation of an `Any` value uses the regular
|
|
||||||
* representation of the deserialized, embedded message, with an
|
|
||||||
* additional field `@type` which contains the type URL. Example:
|
|
||||||
*
|
|
||||||
* package google.profile;
|
|
||||||
* message Person {
|
|
||||||
* string first_name = 1;
|
|
||||||
* string last_name = 2;
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* {
|
|
||||||
* "@type": "type.googleapis.com/google.profile.Person",
|
|
||||||
* "firstName": <string>,
|
|
||||||
* "lastName": <string>
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* If the embedded message type is well-known and has a custom JSON
|
|
||||||
* representation, that representation will be embedded adding a field
|
|
||||||
* `value` which holds the custom JSON in addition to the `@type`
|
|
||||||
* field. Example (for message [google.protobuf.Duration][]):
|
|
||||||
*
|
|
||||||
* {
|
|
||||||
* "@type": "type.googleapis.com/google.protobuf.Duration",
|
|
||||||
* "value": "1.212s"
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
export interface Any {
|
|
||||||
/**
|
|
||||||
* A URL/resource name that uniquely identifies the type of the serialized
|
|
||||||
* protocol buffer message. This string must contain at least
|
|
||||||
* one "/" character. The last segment of the URL's path must represent
|
|
||||||
* the fully qualified name of the type (as in
|
|
||||||
* `path/google.protobuf.Duration`). The name should be in a canonical form
|
|
||||||
* (e.g., leading "." is not accepted).
|
|
||||||
*
|
|
||||||
* In practice, teams usually precompile into the binary all types that they
|
|
||||||
* expect it to use in the context of Any. However, for URLs which use the
|
|
||||||
* scheme `http`, `https`, or no scheme, one can optionally set up a type
|
|
||||||
* server that maps type URLs to message definitions as follows:
|
|
||||||
*
|
|
||||||
* * If no scheme is provided, `https` is assumed.
|
|
||||||
* * An HTTP GET on the URL must yield a [google.protobuf.Type][]
|
|
||||||
* value in binary format, or produce an error.
|
|
||||||
* * Applications are allowed to cache lookup results based on the
|
|
||||||
* URL, or have them precompiled into a binary to avoid any
|
|
||||||
* lookup. Therefore, binary compatibility needs to be preserved
|
|
||||||
* on changes to types. (Use versioned type names to manage
|
|
||||||
* breaking changes.)
|
|
||||||
*
|
|
||||||
* Note: this functionality is not currently available in the official
|
|
||||||
* protobuf release, and it is not used for type URLs beginning with
|
|
||||||
* type.googleapis.com.
|
|
||||||
*
|
|
||||||
* Schemes other than `http`, `https` (or the empty scheme) might be
|
|
||||||
* used with implementation specific semantics.
|
|
||||||
*/
|
|
||||||
type_url: string;
|
|
||||||
/** Must be a valid serialized protocol buffer of the above specified type. */
|
|
||||||
value: Uint8Array;
|
|
||||||
}
|
|
||||||
|
|
||||||
const baseAny: object = { type_url: "" };
|
|
||||||
|
|
||||||
export const Any = {
|
|
||||||
encode(message: Any, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.type_url !== "") {
|
|
||||||
writer.uint32(10).string(message.type_url);
|
|
||||||
}
|
|
||||||
if (message.value.length !== 0) {
|
|
||||||
writer.uint32(18).bytes(message.value);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): Any {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseAny } as Any;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.type_url = reader.string();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.value = reader.bytes();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): Any {
|
|
||||||
const message = { ...baseAny } as Any;
|
|
||||||
if (object.type_url !== undefined && object.type_url !== null) {
|
|
||||||
message.type_url = String(object.type_url);
|
|
||||||
} else {
|
|
||||||
message.type_url = "";
|
|
||||||
}
|
|
||||||
if (object.value !== undefined && object.value !== null) {
|
|
||||||
message.value = bytesFromBase64(object.value);
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: Any): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.type_url !== undefined && (obj.type_url = message.type_url);
|
|
||||||
message.value !== undefined &&
|
|
||||||
(obj.value = base64FromBytes(
|
|
||||||
message.value !== undefined ? message.value : new Uint8Array()
|
|
||||||
));
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<Any>): Any {
|
|
||||||
const message = { ...baseAny } as Any;
|
|
||||||
if (object.type_url !== undefined && object.type_url !== null) {
|
|
||||||
message.type_url = object.type_url;
|
|
||||||
} else {
|
|
||||||
message.type_url = "";
|
|
||||||
}
|
|
||||||
if (object.value !== undefined && object.value !== null) {
|
|
||||||
message.value = object.value;
|
|
||||||
} else {
|
|
||||||
message.value = new Uint8Array();
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
declare var self: any | undefined;
|
|
||||||
declare var window: any | undefined;
|
|
||||||
var globalThis: any = (() => {
|
|
||||||
if (typeof globalThis !== "undefined") return globalThis;
|
|
||||||
if (typeof self !== "undefined") return self;
|
|
||||||
if (typeof window !== "undefined") return window;
|
|
||||||
if (typeof global !== "undefined") return global;
|
|
||||||
throw "Unable to locate global object";
|
|
||||||
})();
|
|
||||||
|
|
||||||
const atob: (b64: string) => string =
|
|
||||||
globalThis.atob ||
|
|
||||||
((b64) => globalThis.Buffer.from(b64, "base64").toString("binary"));
|
|
||||||
function bytesFromBase64(b64: string): Uint8Array {
|
|
||||||
const bin = atob(b64);
|
|
||||||
const arr = new Uint8Array(bin.length);
|
|
||||||
for (let i = 0; i < bin.length; ++i) {
|
|
||||||
arr[i] = bin.charCodeAt(i);
|
|
||||||
}
|
|
||||||
return arr;
|
|
||||||
}
|
|
||||||
|
|
||||||
const btoa: (bin: string) => string =
|
|
||||||
globalThis.btoa ||
|
|
||||||
((bin) => globalThis.Buffer.from(bin, "binary").toString("base64"));
|
|
||||||
function base64FromBytes(arr: Uint8Array): string {
|
|
||||||
const bin: string[] = [];
|
|
||||||
for (let i = 0; i < arr.byteLength; ++i) {
|
|
||||||
bin.push(String.fromCharCode(arr[i]));
|
|
||||||
}
|
|
||||||
return btoa(bin.join(""));
|
|
||||||
}
|
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
||||||
export type DeepPartial<T> = T extends Builtin
|
|
||||||
? T
|
|
||||||
: T extends Array<infer U>
|
|
||||||
? Array<DeepPartial<U>>
|
|
||||||
: T extends ReadonlyArray<infer U>
|
|
||||||
? ReadonlyArray<DeepPartial<U>>
|
|
||||||
: T extends {}
|
|
||||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
||||||
: Partial<T>;
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,219 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import * as Long from "long";
|
|
||||||
import { util, configure, Writer, Reader } from "protobufjs/minimal";
|
|
||||||
|
|
||||||
export const protobufPackage = "google.protobuf";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A Timestamp represents a point in time independent of any time zone or local
|
|
||||||
* calendar, encoded as a count of seconds and fractions of seconds at
|
|
||||||
* nanosecond resolution. The count is relative to an epoch at UTC midnight on
|
|
||||||
* January 1, 1970, in the proleptic Gregorian calendar which extends the
|
|
||||||
* Gregorian calendar backwards to year one.
|
|
||||||
*
|
|
||||||
* All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
|
|
||||||
* second table is needed for interpretation, using a [24-hour linear
|
|
||||||
* smear](https://developers.google.com/time/smear).
|
|
||||||
*
|
|
||||||
* The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
|
|
||||||
* restricting to that range, we ensure that we can convert to and from [RFC
|
|
||||||
* 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
|
|
||||||
*
|
|
||||||
* # Examples
|
|
||||||
*
|
|
||||||
* Example 1: Compute Timestamp from POSIX `time()`.
|
|
||||||
*
|
|
||||||
* Timestamp timestamp;
|
|
||||||
* timestamp.set_seconds(time(NULL));
|
|
||||||
* timestamp.set_nanos(0);
|
|
||||||
*
|
|
||||||
* Example 2: Compute Timestamp from POSIX `gettimeofday()`.
|
|
||||||
*
|
|
||||||
* struct timeval tv;
|
|
||||||
* gettimeofday(&tv, NULL);
|
|
||||||
*
|
|
||||||
* Timestamp timestamp;
|
|
||||||
* timestamp.set_seconds(tv.tv_sec);
|
|
||||||
* timestamp.set_nanos(tv.tv_usec * 1000);
|
|
||||||
*
|
|
||||||
* Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
|
|
||||||
*
|
|
||||||
* FILETIME ft;
|
|
||||||
* GetSystemTimeAsFileTime(&ft);
|
|
||||||
* UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
|
|
||||||
*
|
|
||||||
* // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
|
|
||||||
* // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
|
|
||||||
* Timestamp timestamp;
|
|
||||||
* timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
|
|
||||||
* timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
|
|
||||||
*
|
|
||||||
* Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
|
|
||||||
*
|
|
||||||
* long millis = System.currentTimeMillis();
|
|
||||||
*
|
|
||||||
* Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
|
|
||||||
* .setNanos((int) ((millis % 1000) * 1000000)).build();
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Example 5: Compute Timestamp from Java `Instant.now()`.
|
|
||||||
*
|
|
||||||
* Instant now = Instant.now();
|
|
||||||
*
|
|
||||||
* Timestamp timestamp =
|
|
||||||
* Timestamp.newBuilder().setSeconds(now.getEpochSecond())
|
|
||||||
* .setNanos(now.getNano()).build();
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Example 6: Compute Timestamp from current time in Python.
|
|
||||||
*
|
|
||||||
* timestamp = Timestamp()
|
|
||||||
* timestamp.GetCurrentTime()
|
|
||||||
*
|
|
||||||
* # JSON Mapping
|
|
||||||
*
|
|
||||||
* In JSON format, the Timestamp type is encoded as a string in the
|
|
||||||
* [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
|
|
||||||
* format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
|
|
||||||
* where {year} is always expressed using four digits while {month}, {day},
|
|
||||||
* {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
|
|
||||||
* seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
|
|
||||||
* are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
|
|
||||||
* is required. A proto3 JSON serializer should always use UTC (as indicated by
|
|
||||||
* "Z") when printing the Timestamp type and a proto3 JSON parser should be
|
|
||||||
* able to accept both UTC and other timezones (as indicated by an offset).
|
|
||||||
*
|
|
||||||
* For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
|
|
||||||
* 01:30 UTC on January 15, 2017.
|
|
||||||
*
|
|
||||||
* In JavaScript, one can convert a Date object to this format using the
|
|
||||||
* standard
|
|
||||||
* [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
|
|
||||||
* method. In Python, a standard `datetime.datetime` object can be converted
|
|
||||||
* to this format using
|
|
||||||
* [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
|
|
||||||
* the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
|
|
||||||
* the Joda Time's [`ISODateTimeFormat.dateTime()`](
|
|
||||||
* http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
|
|
||||||
* ) to obtain a formatter capable of generating timestamps in this format.
|
|
||||||
*/
|
|
||||||
export interface Timestamp {
|
|
||||||
/**
|
|
||||||
* Represents seconds of UTC time since Unix epoch
|
|
||||||
* 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
|
|
||||||
* 9999-12-31T23:59:59Z inclusive.
|
|
||||||
*/
|
|
||||||
seconds: number;
|
|
||||||
/**
|
|
||||||
* Non-negative fractions of a second at nanosecond resolution. Negative
|
|
||||||
* second values with fractions must still have non-negative nanos values
|
|
||||||
* that count forward in time. Must be from 0 to 999,999,999
|
|
||||||
* inclusive.
|
|
||||||
*/
|
|
||||||
nanos: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
const baseTimestamp: object = { seconds: 0, nanos: 0 };
|
|
||||||
|
|
||||||
export const Timestamp = {
|
|
||||||
encode(message: Timestamp, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.seconds !== 0) {
|
|
||||||
writer.uint32(8).int64(message.seconds);
|
|
||||||
}
|
|
||||||
if (message.nanos !== 0) {
|
|
||||||
writer.uint32(16).int32(message.nanos);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): Timestamp {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseTimestamp } as Timestamp;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.seconds = longToNumber(reader.int64() as Long);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.nanos = reader.int32();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): Timestamp {
|
|
||||||
const message = { ...baseTimestamp } as Timestamp;
|
|
||||||
if (object.seconds !== undefined && object.seconds !== null) {
|
|
||||||
message.seconds = Number(object.seconds);
|
|
||||||
} else {
|
|
||||||
message.seconds = 0;
|
|
||||||
}
|
|
||||||
if (object.nanos !== undefined && object.nanos !== null) {
|
|
||||||
message.nanos = Number(object.nanos);
|
|
||||||
} else {
|
|
||||||
message.nanos = 0;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: Timestamp): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.seconds !== undefined && (obj.seconds = message.seconds);
|
|
||||||
message.nanos !== undefined && (obj.nanos = message.nanos);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<Timestamp>): Timestamp {
|
|
||||||
const message = { ...baseTimestamp } as Timestamp;
|
|
||||||
if (object.seconds !== undefined && object.seconds !== null) {
|
|
||||||
message.seconds = object.seconds;
|
|
||||||
} else {
|
|
||||||
message.seconds = 0;
|
|
||||||
}
|
|
||||||
if (object.nanos !== undefined && object.nanos !== null) {
|
|
||||||
message.nanos = object.nanos;
|
|
||||||
} else {
|
|
||||||
message.nanos = 0;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
declare var self: any | undefined;
|
|
||||||
declare var window: any | undefined;
|
|
||||||
var globalThis: any = (() => {
|
|
||||||
if (typeof globalThis !== "undefined") return globalThis;
|
|
||||||
if (typeof self !== "undefined") return self;
|
|
||||||
if (typeof window !== "undefined") return window;
|
|
||||||
if (typeof global !== "undefined") return global;
|
|
||||||
throw "Unable to locate global object";
|
|
||||||
})();
|
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
||||||
export type DeepPartial<T> = T extends Builtin
|
|
||||||
? T
|
|
||||||
: T extends Array<infer U>
|
|
||||||
? Array<DeepPartial<U>>
|
|
||||||
: T extends ReadonlyArray<infer U>
|
|
||||||
? ReadonlyArray<DeepPartial<U>>
|
|
||||||
: T extends {}
|
|
||||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
||||||
: Partial<T>;
|
|
||||||
|
|
||||||
function longToNumber(long: Long): number {
|
|
||||||
if (long.gt(Number.MAX_SAFE_INTEGER)) {
|
|
||||||
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
|
||||||
}
|
|
||||||
return long.toNumber();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (util.Long !== Long) {
|
|
||||||
util.Long = Long as any;
|
|
||||||
configure();
|
|
||||||
}
|
|
|
@ -1,130 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import { Writer, Reader } from "protobufjs/minimal";
|
|
||||||
|
|
||||||
export const protobufPackage = "tendermint.crypto";
|
|
||||||
|
|
||||||
/** PublicKey defines the keys available for use with Tendermint Validators */
|
|
||||||
export interface PublicKey {
|
|
||||||
ed25519: Uint8Array | undefined;
|
|
||||||
secp256k1: Uint8Array | undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
const basePublicKey: object = {};
|
|
||||||
|
|
||||||
export const PublicKey = {
|
|
||||||
encode(message: PublicKey, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.ed25519 !== undefined) {
|
|
||||||
writer.uint32(10).bytes(message.ed25519);
|
|
||||||
}
|
|
||||||
if (message.secp256k1 !== undefined) {
|
|
||||||
writer.uint32(18).bytes(message.secp256k1);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): PublicKey {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...basePublicKey } as PublicKey;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.ed25519 = reader.bytes();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.secp256k1 = reader.bytes();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): PublicKey {
|
|
||||||
const message = { ...basePublicKey } as PublicKey;
|
|
||||||
if (object.ed25519 !== undefined && object.ed25519 !== null) {
|
|
||||||
message.ed25519 = bytesFromBase64(object.ed25519);
|
|
||||||
}
|
|
||||||
if (object.secp256k1 !== undefined && object.secp256k1 !== null) {
|
|
||||||
message.secp256k1 = bytesFromBase64(object.secp256k1);
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: PublicKey): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.ed25519 !== undefined &&
|
|
||||||
(obj.ed25519 =
|
|
||||||
message.ed25519 !== undefined
|
|
||||||
? base64FromBytes(message.ed25519)
|
|
||||||
: undefined);
|
|
||||||
message.secp256k1 !== undefined &&
|
|
||||||
(obj.secp256k1 =
|
|
||||||
message.secp256k1 !== undefined
|
|
||||||
? base64FromBytes(message.secp256k1)
|
|
||||||
: undefined);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<PublicKey>): PublicKey {
|
|
||||||
const message = { ...basePublicKey } as PublicKey;
|
|
||||||
if (object.ed25519 !== undefined && object.ed25519 !== null) {
|
|
||||||
message.ed25519 = object.ed25519;
|
|
||||||
} else {
|
|
||||||
message.ed25519 = undefined;
|
|
||||||
}
|
|
||||||
if (object.secp256k1 !== undefined && object.secp256k1 !== null) {
|
|
||||||
message.secp256k1 = object.secp256k1;
|
|
||||||
} else {
|
|
||||||
message.secp256k1 = undefined;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
declare var self: any | undefined;
|
|
||||||
declare var window: any | undefined;
|
|
||||||
var globalThis: any = (() => {
|
|
||||||
if (typeof globalThis !== "undefined") return globalThis;
|
|
||||||
if (typeof self !== "undefined") return self;
|
|
||||||
if (typeof window !== "undefined") return window;
|
|
||||||
if (typeof global !== "undefined") return global;
|
|
||||||
throw "Unable to locate global object";
|
|
||||||
})();
|
|
||||||
|
|
||||||
const atob: (b64: string) => string =
|
|
||||||
globalThis.atob ||
|
|
||||||
((b64) => globalThis.Buffer.from(b64, "base64").toString("binary"));
|
|
||||||
function bytesFromBase64(b64: string): Uint8Array {
|
|
||||||
const bin = atob(b64);
|
|
||||||
const arr = new Uint8Array(bin.length);
|
|
||||||
for (let i = 0; i < bin.length; ++i) {
|
|
||||||
arr[i] = bin.charCodeAt(i);
|
|
||||||
}
|
|
||||||
return arr;
|
|
||||||
}
|
|
||||||
|
|
||||||
const btoa: (bin: string) => string =
|
|
||||||
globalThis.btoa ||
|
|
||||||
((bin) => globalThis.Buffer.from(bin, "binary").toString("base64"));
|
|
||||||
function base64FromBytes(arr: Uint8Array): string {
|
|
||||||
const bin: string[] = [];
|
|
||||||
for (let i = 0; i < arr.byteLength; ++i) {
|
|
||||||
bin.push(String.fromCharCode(arr[i]));
|
|
||||||
}
|
|
||||||
return btoa(bin.join(""));
|
|
||||||
}
|
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
||||||
export type DeepPartial<T> = T extends Builtin
|
|
||||||
? T
|
|
||||||
: T extends Array<infer U>
|
|
||||||
? Array<DeepPartial<U>>
|
|
||||||
: T extends ReadonlyArray<infer U>
|
|
||||||
? ReadonlyArray<DeepPartial<U>>
|
|
||||||
: T extends {}
|
|
||||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
||||||
: Partial<T>;
|
|
|
@ -1,529 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import * as Long from "long";
|
|
||||||
import { util, configure, Writer, Reader } from "protobufjs/minimal";
|
|
||||||
|
|
||||||
export const protobufPackage = "tendermint.crypto";
|
|
||||||
|
|
||||||
export interface Proof {
|
|
||||||
total: number;
|
|
||||||
index: number;
|
|
||||||
leaf_hash: Uint8Array;
|
|
||||||
aunts: Uint8Array[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ValueOp {
|
|
||||||
/** Encoded in ProofOp.Key. */
|
|
||||||
key: Uint8Array;
|
|
||||||
/** To encode in ProofOp.Data */
|
|
||||||
proof: Proof | undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface DominoOp {
|
|
||||||
key: string;
|
|
||||||
input: string;
|
|
||||||
output: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ProofOp defines an operation used for calculating Merkle root
|
|
||||||
* The data could be arbitrary format, providing nessecary data
|
|
||||||
* for example neighbouring node hash
|
|
||||||
*/
|
|
||||||
export interface ProofOp {
|
|
||||||
type: string;
|
|
||||||
key: Uint8Array;
|
|
||||||
data: Uint8Array;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** ProofOps is Merkle proof defined by the list of ProofOps */
|
|
||||||
export interface ProofOps {
|
|
||||||
ops: ProofOp[];
|
|
||||||
}
|
|
||||||
|
|
||||||
const baseProof: object = { total: 0, index: 0 };
|
|
||||||
|
|
||||||
export const Proof = {
|
|
||||||
encode(message: Proof, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.total !== 0) {
|
|
||||||
writer.uint32(8).int64(message.total);
|
|
||||||
}
|
|
||||||
if (message.index !== 0) {
|
|
||||||
writer.uint32(16).int64(message.index);
|
|
||||||
}
|
|
||||||
if (message.leaf_hash.length !== 0) {
|
|
||||||
writer.uint32(26).bytes(message.leaf_hash);
|
|
||||||
}
|
|
||||||
for (const v of message.aunts) {
|
|
||||||
writer.uint32(34).bytes(v!);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): Proof {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseProof } as Proof;
|
|
||||||
message.aunts = [];
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.total = longToNumber(reader.int64() as Long);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.index = longToNumber(reader.int64() as Long);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
message.leaf_hash = reader.bytes();
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
message.aunts.push(reader.bytes());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): Proof {
|
|
||||||
const message = { ...baseProof } as Proof;
|
|
||||||
message.aunts = [];
|
|
||||||
if (object.total !== undefined && object.total !== null) {
|
|
||||||
message.total = Number(object.total);
|
|
||||||
} else {
|
|
||||||
message.total = 0;
|
|
||||||
}
|
|
||||||
if (object.index !== undefined && object.index !== null) {
|
|
||||||
message.index = Number(object.index);
|
|
||||||
} else {
|
|
||||||
message.index = 0;
|
|
||||||
}
|
|
||||||
if (object.leaf_hash !== undefined && object.leaf_hash !== null) {
|
|
||||||
message.leaf_hash = bytesFromBase64(object.leaf_hash);
|
|
||||||
}
|
|
||||||
if (object.aunts !== undefined && object.aunts !== null) {
|
|
||||||
for (const e of object.aunts) {
|
|
||||||
message.aunts.push(bytesFromBase64(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: Proof): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.total !== undefined && (obj.total = message.total);
|
|
||||||
message.index !== undefined && (obj.index = message.index);
|
|
||||||
message.leaf_hash !== undefined &&
|
|
||||||
(obj.leaf_hash = base64FromBytes(
|
|
||||||
message.leaf_hash !== undefined ? message.leaf_hash : new Uint8Array()
|
|
||||||
));
|
|
||||||
if (message.aunts) {
|
|
||||||
obj.aunts = message.aunts.map((e) =>
|
|
||||||
base64FromBytes(e !== undefined ? e : new Uint8Array())
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
obj.aunts = [];
|
|
||||||
}
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<Proof>): Proof {
|
|
||||||
const message = { ...baseProof } as Proof;
|
|
||||||
message.aunts = [];
|
|
||||||
if (object.total !== undefined && object.total !== null) {
|
|
||||||
message.total = object.total;
|
|
||||||
} else {
|
|
||||||
message.total = 0;
|
|
||||||
}
|
|
||||||
if (object.index !== undefined && object.index !== null) {
|
|
||||||
message.index = object.index;
|
|
||||||
} else {
|
|
||||||
message.index = 0;
|
|
||||||
}
|
|
||||||
if (object.leaf_hash !== undefined && object.leaf_hash !== null) {
|
|
||||||
message.leaf_hash = object.leaf_hash;
|
|
||||||
} else {
|
|
||||||
message.leaf_hash = new Uint8Array();
|
|
||||||
}
|
|
||||||
if (object.aunts !== undefined && object.aunts !== null) {
|
|
||||||
for (const e of object.aunts) {
|
|
||||||
message.aunts.push(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseValueOp: object = {};
|
|
||||||
|
|
||||||
export const ValueOp = {
|
|
||||||
encode(message: ValueOp, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.key.length !== 0) {
|
|
||||||
writer.uint32(10).bytes(message.key);
|
|
||||||
}
|
|
||||||
if (message.proof !== undefined) {
|
|
||||||
Proof.encode(message.proof, writer.uint32(18).fork()).ldelim();
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): ValueOp {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseValueOp } as ValueOp;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.key = reader.bytes();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.proof = Proof.decode(reader, reader.uint32());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): ValueOp {
|
|
||||||
const message = { ...baseValueOp } as ValueOp;
|
|
||||||
if (object.key !== undefined && object.key !== null) {
|
|
||||||
message.key = bytesFromBase64(object.key);
|
|
||||||
}
|
|
||||||
if (object.proof !== undefined && object.proof !== null) {
|
|
||||||
message.proof = Proof.fromJSON(object.proof);
|
|
||||||
} else {
|
|
||||||
message.proof = undefined;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: ValueOp): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.key !== undefined &&
|
|
||||||
(obj.key = base64FromBytes(
|
|
||||||
message.key !== undefined ? message.key : new Uint8Array()
|
|
||||||
));
|
|
||||||
message.proof !== undefined &&
|
|
||||||
(obj.proof = message.proof ? Proof.toJSON(message.proof) : undefined);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<ValueOp>): ValueOp {
|
|
||||||
const message = { ...baseValueOp } as ValueOp;
|
|
||||||
if (object.key !== undefined && object.key !== null) {
|
|
||||||
message.key = object.key;
|
|
||||||
} else {
|
|
||||||
message.key = new Uint8Array();
|
|
||||||
}
|
|
||||||
if (object.proof !== undefined && object.proof !== null) {
|
|
||||||
message.proof = Proof.fromPartial(object.proof);
|
|
||||||
} else {
|
|
||||||
message.proof = undefined;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseDominoOp: object = { key: "", input: "", output: "" };
|
|
||||||
|
|
||||||
export const DominoOp = {
|
|
||||||
encode(message: DominoOp, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.key !== "") {
|
|
||||||
writer.uint32(10).string(message.key);
|
|
||||||
}
|
|
||||||
if (message.input !== "") {
|
|
||||||
writer.uint32(18).string(message.input);
|
|
||||||
}
|
|
||||||
if (message.output !== "") {
|
|
||||||
writer.uint32(26).string(message.output);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): DominoOp {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseDominoOp } as DominoOp;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.key = reader.string();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.input = reader.string();
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
message.output = reader.string();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): DominoOp {
|
|
||||||
const message = { ...baseDominoOp } as DominoOp;
|
|
||||||
if (object.key !== undefined && object.key !== null) {
|
|
||||||
message.key = String(object.key);
|
|
||||||
} else {
|
|
||||||
message.key = "";
|
|
||||||
}
|
|
||||||
if (object.input !== undefined && object.input !== null) {
|
|
||||||
message.input = String(object.input);
|
|
||||||
} else {
|
|
||||||
message.input = "";
|
|
||||||
}
|
|
||||||
if (object.output !== undefined && object.output !== null) {
|
|
||||||
message.output = String(object.output);
|
|
||||||
} else {
|
|
||||||
message.output = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: DominoOp): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.key !== undefined && (obj.key = message.key);
|
|
||||||
message.input !== undefined && (obj.input = message.input);
|
|
||||||
message.output !== undefined && (obj.output = message.output);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<DominoOp>): DominoOp {
|
|
||||||
const message = { ...baseDominoOp } as DominoOp;
|
|
||||||
if (object.key !== undefined && object.key !== null) {
|
|
||||||
message.key = object.key;
|
|
||||||
} else {
|
|
||||||
message.key = "";
|
|
||||||
}
|
|
||||||
if (object.input !== undefined && object.input !== null) {
|
|
||||||
message.input = object.input;
|
|
||||||
} else {
|
|
||||||
message.input = "";
|
|
||||||
}
|
|
||||||
if (object.output !== undefined && object.output !== null) {
|
|
||||||
message.output = object.output;
|
|
||||||
} else {
|
|
||||||
message.output = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseProofOp: object = { type: "" };
|
|
||||||
|
|
||||||
export const ProofOp = {
|
|
||||||
encode(message: ProofOp, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.type !== "") {
|
|
||||||
writer.uint32(10).string(message.type);
|
|
||||||
}
|
|
||||||
if (message.key.length !== 0) {
|
|
||||||
writer.uint32(18).bytes(message.key);
|
|
||||||
}
|
|
||||||
if (message.data.length !== 0) {
|
|
||||||
writer.uint32(26).bytes(message.data);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): ProofOp {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseProofOp } as ProofOp;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.type = reader.string();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.key = reader.bytes();
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
message.data = reader.bytes();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): ProofOp {
|
|
||||||
const message = { ...baseProofOp } as ProofOp;
|
|
||||||
if (object.type !== undefined && object.type !== null) {
|
|
||||||
message.type = String(object.type);
|
|
||||||
} else {
|
|
||||||
message.type = "";
|
|
||||||
}
|
|
||||||
if (object.key !== undefined && object.key !== null) {
|
|
||||||
message.key = bytesFromBase64(object.key);
|
|
||||||
}
|
|
||||||
if (object.data !== undefined && object.data !== null) {
|
|
||||||
message.data = bytesFromBase64(object.data);
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: ProofOp): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.type !== undefined && (obj.type = message.type);
|
|
||||||
message.key !== undefined &&
|
|
||||||
(obj.key = base64FromBytes(
|
|
||||||
message.key !== undefined ? message.key : new Uint8Array()
|
|
||||||
));
|
|
||||||
message.data !== undefined &&
|
|
||||||
(obj.data = base64FromBytes(
|
|
||||||
message.data !== undefined ? message.data : new Uint8Array()
|
|
||||||
));
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<ProofOp>): ProofOp {
|
|
||||||
const message = { ...baseProofOp } as ProofOp;
|
|
||||||
if (object.type !== undefined && object.type !== null) {
|
|
||||||
message.type = object.type;
|
|
||||||
} else {
|
|
||||||
message.type = "";
|
|
||||||
}
|
|
||||||
if (object.key !== undefined && object.key !== null) {
|
|
||||||
message.key = object.key;
|
|
||||||
} else {
|
|
||||||
message.key = new Uint8Array();
|
|
||||||
}
|
|
||||||
if (object.data !== undefined && object.data !== null) {
|
|
||||||
message.data = object.data;
|
|
||||||
} else {
|
|
||||||
message.data = new Uint8Array();
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseProofOps: object = {};
|
|
||||||
|
|
||||||
export const ProofOps = {
|
|
||||||
encode(message: ProofOps, writer: Writer = Writer.create()): Writer {
|
|
||||||
for (const v of message.ops) {
|
|
||||||
ProofOp.encode(v!, writer.uint32(10).fork()).ldelim();
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): ProofOps {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseProofOps } as ProofOps;
|
|
||||||
message.ops = [];
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.ops.push(ProofOp.decode(reader, reader.uint32()));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): ProofOps {
|
|
||||||
const message = { ...baseProofOps } as ProofOps;
|
|
||||||
message.ops = [];
|
|
||||||
if (object.ops !== undefined && object.ops !== null) {
|
|
||||||
for (const e of object.ops) {
|
|
||||||
message.ops.push(ProofOp.fromJSON(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: ProofOps): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
if (message.ops) {
|
|
||||||
obj.ops = message.ops.map((e) => (e ? ProofOp.toJSON(e) : undefined));
|
|
||||||
} else {
|
|
||||||
obj.ops = [];
|
|
||||||
}
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<ProofOps>): ProofOps {
|
|
||||||
const message = { ...baseProofOps } as ProofOps;
|
|
||||||
message.ops = [];
|
|
||||||
if (object.ops !== undefined && object.ops !== null) {
|
|
||||||
for (const e of object.ops) {
|
|
||||||
message.ops.push(ProofOp.fromPartial(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
declare var self: any | undefined;
|
|
||||||
declare var window: any | undefined;
|
|
||||||
var globalThis: any = (() => {
|
|
||||||
if (typeof globalThis !== "undefined") return globalThis;
|
|
||||||
if (typeof self !== "undefined") return self;
|
|
||||||
if (typeof window !== "undefined") return window;
|
|
||||||
if (typeof global !== "undefined") return global;
|
|
||||||
throw "Unable to locate global object";
|
|
||||||
})();
|
|
||||||
|
|
||||||
const atob: (b64: string) => string =
|
|
||||||
globalThis.atob ||
|
|
||||||
((b64) => globalThis.Buffer.from(b64, "base64").toString("binary"));
|
|
||||||
function bytesFromBase64(b64: string): Uint8Array {
|
|
||||||
const bin = atob(b64);
|
|
||||||
const arr = new Uint8Array(bin.length);
|
|
||||||
for (let i = 0; i < bin.length; ++i) {
|
|
||||||
arr[i] = bin.charCodeAt(i);
|
|
||||||
}
|
|
||||||
return arr;
|
|
||||||
}
|
|
||||||
|
|
||||||
const btoa: (bin: string) => string =
|
|
||||||
globalThis.btoa ||
|
|
||||||
((bin) => globalThis.Buffer.from(bin, "binary").toString("base64"));
|
|
||||||
function base64FromBytes(arr: Uint8Array): string {
|
|
||||||
const bin: string[] = [];
|
|
||||||
for (let i = 0; i < arr.byteLength; ++i) {
|
|
||||||
bin.push(String.fromCharCode(arr[i]));
|
|
||||||
}
|
|
||||||
return btoa(bin.join(""));
|
|
||||||
}
|
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
||||||
export type DeepPartial<T> = T extends Builtin
|
|
||||||
? T
|
|
||||||
: T extends Array<infer U>
|
|
||||||
? Array<DeepPartial<U>>
|
|
||||||
: T extends ReadonlyArray<infer U>
|
|
||||||
? ReadonlyArray<DeepPartial<U>>
|
|
||||||
: T extends {}
|
|
||||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
||||||
: Partial<T>;
|
|
||||||
|
|
||||||
function longToNumber(long: Long): number {
|
|
||||||
if (long.gt(Number.MAX_SAFE_INTEGER)) {
|
|
||||||
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
|
||||||
}
|
|
||||||
return long.toNumber();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (util.Long !== Long) {
|
|
||||||
util.Long = Long as any;
|
|
||||||
configure();
|
|
||||||
}
|
|
|
@ -1,557 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import * as Long from "long";
|
|
||||||
import { util, configure, Writer, Reader } from "protobufjs/minimal";
|
|
||||||
|
|
||||||
export const protobufPackage = "tendermint.p2p";
|
|
||||||
|
|
||||||
export interface NetAddress {
|
|
||||||
id: string;
|
|
||||||
ip: string;
|
|
||||||
port: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ProtocolVersion {
|
|
||||||
p2p: number;
|
|
||||||
block: number;
|
|
||||||
app: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface DefaultNodeInfo {
|
|
||||||
protocol_version: ProtocolVersion | undefined;
|
|
||||||
default_node_id: string;
|
|
||||||
listen_addr: string;
|
|
||||||
network: string;
|
|
||||||
version: string;
|
|
||||||
channels: Uint8Array;
|
|
||||||
moniker: string;
|
|
||||||
other: DefaultNodeInfoOther | undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface DefaultNodeInfoOther {
|
|
||||||
tx_index: string;
|
|
||||||
rpc_address: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
const baseNetAddress: object = { id: "", ip: "", port: 0 };
|
|
||||||
|
|
||||||
export const NetAddress = {
|
|
||||||
encode(message: NetAddress, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.id !== "") {
|
|
||||||
writer.uint32(10).string(message.id);
|
|
||||||
}
|
|
||||||
if (message.ip !== "") {
|
|
||||||
writer.uint32(18).string(message.ip);
|
|
||||||
}
|
|
||||||
if (message.port !== 0) {
|
|
||||||
writer.uint32(24).uint32(message.port);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): NetAddress {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseNetAddress } as NetAddress;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.id = reader.string();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.ip = reader.string();
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
message.port = reader.uint32();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): NetAddress {
|
|
||||||
const message = { ...baseNetAddress } as NetAddress;
|
|
||||||
if (object.id !== undefined && object.id !== null) {
|
|
||||||
message.id = String(object.id);
|
|
||||||
} else {
|
|
||||||
message.id = "";
|
|
||||||
}
|
|
||||||
if (object.ip !== undefined && object.ip !== null) {
|
|
||||||
message.ip = String(object.ip);
|
|
||||||
} else {
|
|
||||||
message.ip = "";
|
|
||||||
}
|
|
||||||
if (object.port !== undefined && object.port !== null) {
|
|
||||||
message.port = Number(object.port);
|
|
||||||
} else {
|
|
||||||
message.port = 0;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: NetAddress): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.id !== undefined && (obj.id = message.id);
|
|
||||||
message.ip !== undefined && (obj.ip = message.ip);
|
|
||||||
message.port !== undefined && (obj.port = message.port);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<NetAddress>): NetAddress {
|
|
||||||
const message = { ...baseNetAddress } as NetAddress;
|
|
||||||
if (object.id !== undefined && object.id !== null) {
|
|
||||||
message.id = object.id;
|
|
||||||
} else {
|
|
||||||
message.id = "";
|
|
||||||
}
|
|
||||||
if (object.ip !== undefined && object.ip !== null) {
|
|
||||||
message.ip = object.ip;
|
|
||||||
} else {
|
|
||||||
message.ip = "";
|
|
||||||
}
|
|
||||||
if (object.port !== undefined && object.port !== null) {
|
|
||||||
message.port = object.port;
|
|
||||||
} else {
|
|
||||||
message.port = 0;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseProtocolVersion: object = { p2p: 0, block: 0, app: 0 };
|
|
||||||
|
|
||||||
export const ProtocolVersion = {
|
|
||||||
encode(message: ProtocolVersion, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.p2p !== 0) {
|
|
||||||
writer.uint32(8).uint64(message.p2p);
|
|
||||||
}
|
|
||||||
if (message.block !== 0) {
|
|
||||||
writer.uint32(16).uint64(message.block);
|
|
||||||
}
|
|
||||||
if (message.app !== 0) {
|
|
||||||
writer.uint32(24).uint64(message.app);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): ProtocolVersion {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseProtocolVersion } as ProtocolVersion;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.p2p = longToNumber(reader.uint64() as Long);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.block = longToNumber(reader.uint64() as Long);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
message.app = longToNumber(reader.uint64() as Long);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): ProtocolVersion {
|
|
||||||
const message = { ...baseProtocolVersion } as ProtocolVersion;
|
|
||||||
if (object.p2p !== undefined && object.p2p !== null) {
|
|
||||||
message.p2p = Number(object.p2p);
|
|
||||||
} else {
|
|
||||||
message.p2p = 0;
|
|
||||||
}
|
|
||||||
if (object.block !== undefined && object.block !== null) {
|
|
||||||
message.block = Number(object.block);
|
|
||||||
} else {
|
|
||||||
message.block = 0;
|
|
||||||
}
|
|
||||||
if (object.app !== undefined && object.app !== null) {
|
|
||||||
message.app = Number(object.app);
|
|
||||||
} else {
|
|
||||||
message.app = 0;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: ProtocolVersion): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.p2p !== undefined && (obj.p2p = message.p2p);
|
|
||||||
message.block !== undefined && (obj.block = message.block);
|
|
||||||
message.app !== undefined && (obj.app = message.app);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<ProtocolVersion>): ProtocolVersion {
|
|
||||||
const message = { ...baseProtocolVersion } as ProtocolVersion;
|
|
||||||
if (object.p2p !== undefined && object.p2p !== null) {
|
|
||||||
message.p2p = object.p2p;
|
|
||||||
} else {
|
|
||||||
message.p2p = 0;
|
|
||||||
}
|
|
||||||
if (object.block !== undefined && object.block !== null) {
|
|
||||||
message.block = object.block;
|
|
||||||
} else {
|
|
||||||
message.block = 0;
|
|
||||||
}
|
|
||||||
if (object.app !== undefined && object.app !== null) {
|
|
||||||
message.app = object.app;
|
|
||||||
} else {
|
|
||||||
message.app = 0;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseDefaultNodeInfo: object = {
|
|
||||||
default_node_id: "",
|
|
||||||
listen_addr: "",
|
|
||||||
network: "",
|
|
||||||
version: "",
|
|
||||||
moniker: "",
|
|
||||||
};
|
|
||||||
|
|
||||||
export const DefaultNodeInfo = {
|
|
||||||
encode(message: DefaultNodeInfo, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.protocol_version !== undefined) {
|
|
||||||
ProtocolVersion.encode(
|
|
||||||
message.protocol_version,
|
|
||||||
writer.uint32(10).fork()
|
|
||||||
).ldelim();
|
|
||||||
}
|
|
||||||
if (message.default_node_id !== "") {
|
|
||||||
writer.uint32(18).string(message.default_node_id);
|
|
||||||
}
|
|
||||||
if (message.listen_addr !== "") {
|
|
||||||
writer.uint32(26).string(message.listen_addr);
|
|
||||||
}
|
|
||||||
if (message.network !== "") {
|
|
||||||
writer.uint32(34).string(message.network);
|
|
||||||
}
|
|
||||||
if (message.version !== "") {
|
|
||||||
writer.uint32(42).string(message.version);
|
|
||||||
}
|
|
||||||
if (message.channels.length !== 0) {
|
|
||||||
writer.uint32(50).bytes(message.channels);
|
|
||||||
}
|
|
||||||
if (message.moniker !== "") {
|
|
||||||
writer.uint32(58).string(message.moniker);
|
|
||||||
}
|
|
||||||
if (message.other !== undefined) {
|
|
||||||
DefaultNodeInfoOther.encode(
|
|
||||||
message.other,
|
|
||||||
writer.uint32(66).fork()
|
|
||||||
).ldelim();
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): DefaultNodeInfo {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseDefaultNodeInfo } as DefaultNodeInfo;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.protocol_version = ProtocolVersion.decode(
|
|
||||||
reader,
|
|
||||||
reader.uint32()
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.default_node_id = reader.string();
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
message.listen_addr = reader.string();
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
message.network = reader.string();
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
message.version = reader.string();
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
message.channels = reader.bytes();
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
message.moniker = reader.string();
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
message.other = DefaultNodeInfoOther.decode(reader, reader.uint32());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): DefaultNodeInfo {
|
|
||||||
const message = { ...baseDefaultNodeInfo } as DefaultNodeInfo;
|
|
||||||
if (
|
|
||||||
object.protocol_version !== undefined &&
|
|
||||||
object.protocol_version !== null
|
|
||||||
) {
|
|
||||||
message.protocol_version = ProtocolVersion.fromJSON(
|
|
||||||
object.protocol_version
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
message.protocol_version = undefined;
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.default_node_id !== undefined &&
|
|
||||||
object.default_node_id !== null
|
|
||||||
) {
|
|
||||||
message.default_node_id = String(object.default_node_id);
|
|
||||||
} else {
|
|
||||||
message.default_node_id = "";
|
|
||||||
}
|
|
||||||
if (object.listen_addr !== undefined && object.listen_addr !== null) {
|
|
||||||
message.listen_addr = String(object.listen_addr);
|
|
||||||
} else {
|
|
||||||
message.listen_addr = "";
|
|
||||||
}
|
|
||||||
if (object.network !== undefined && object.network !== null) {
|
|
||||||
message.network = String(object.network);
|
|
||||||
} else {
|
|
||||||
message.network = "";
|
|
||||||
}
|
|
||||||
if (object.version !== undefined && object.version !== null) {
|
|
||||||
message.version = String(object.version);
|
|
||||||
} else {
|
|
||||||
message.version = "";
|
|
||||||
}
|
|
||||||
if (object.channels !== undefined && object.channels !== null) {
|
|
||||||
message.channels = bytesFromBase64(object.channels);
|
|
||||||
}
|
|
||||||
if (object.moniker !== undefined && object.moniker !== null) {
|
|
||||||
message.moniker = String(object.moniker);
|
|
||||||
} else {
|
|
||||||
message.moniker = "";
|
|
||||||
}
|
|
||||||
if (object.other !== undefined && object.other !== null) {
|
|
||||||
message.other = DefaultNodeInfoOther.fromJSON(object.other);
|
|
||||||
} else {
|
|
||||||
message.other = undefined;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: DefaultNodeInfo): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.protocol_version !== undefined &&
|
|
||||||
(obj.protocol_version = message.protocol_version
|
|
||||||
? ProtocolVersion.toJSON(message.protocol_version)
|
|
||||||
: undefined);
|
|
||||||
message.default_node_id !== undefined &&
|
|
||||||
(obj.default_node_id = message.default_node_id);
|
|
||||||
message.listen_addr !== undefined &&
|
|
||||||
(obj.listen_addr = message.listen_addr);
|
|
||||||
message.network !== undefined && (obj.network = message.network);
|
|
||||||
message.version !== undefined && (obj.version = message.version);
|
|
||||||
message.channels !== undefined &&
|
|
||||||
(obj.channels = base64FromBytes(
|
|
||||||
message.channels !== undefined ? message.channels : new Uint8Array()
|
|
||||||
));
|
|
||||||
message.moniker !== undefined && (obj.moniker = message.moniker);
|
|
||||||
message.other !== undefined &&
|
|
||||||
(obj.other = message.other
|
|
||||||
? DefaultNodeInfoOther.toJSON(message.other)
|
|
||||||
: undefined);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<DefaultNodeInfo>): DefaultNodeInfo {
|
|
||||||
const message = { ...baseDefaultNodeInfo } as DefaultNodeInfo;
|
|
||||||
if (
|
|
||||||
object.protocol_version !== undefined &&
|
|
||||||
object.protocol_version !== null
|
|
||||||
) {
|
|
||||||
message.protocol_version = ProtocolVersion.fromPartial(
|
|
||||||
object.protocol_version
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
message.protocol_version = undefined;
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.default_node_id !== undefined &&
|
|
||||||
object.default_node_id !== null
|
|
||||||
) {
|
|
||||||
message.default_node_id = object.default_node_id;
|
|
||||||
} else {
|
|
||||||
message.default_node_id = "";
|
|
||||||
}
|
|
||||||
if (object.listen_addr !== undefined && object.listen_addr !== null) {
|
|
||||||
message.listen_addr = object.listen_addr;
|
|
||||||
} else {
|
|
||||||
message.listen_addr = "";
|
|
||||||
}
|
|
||||||
if (object.network !== undefined && object.network !== null) {
|
|
||||||
message.network = object.network;
|
|
||||||
} else {
|
|
||||||
message.network = "";
|
|
||||||
}
|
|
||||||
if (object.version !== undefined && object.version !== null) {
|
|
||||||
message.version = object.version;
|
|
||||||
} else {
|
|
||||||
message.version = "";
|
|
||||||
}
|
|
||||||
if (object.channels !== undefined && object.channels !== null) {
|
|
||||||
message.channels = object.channels;
|
|
||||||
} else {
|
|
||||||
message.channels = new Uint8Array();
|
|
||||||
}
|
|
||||||
if (object.moniker !== undefined && object.moniker !== null) {
|
|
||||||
message.moniker = object.moniker;
|
|
||||||
} else {
|
|
||||||
message.moniker = "";
|
|
||||||
}
|
|
||||||
if (object.other !== undefined && object.other !== null) {
|
|
||||||
message.other = DefaultNodeInfoOther.fromPartial(object.other);
|
|
||||||
} else {
|
|
||||||
message.other = undefined;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseDefaultNodeInfoOther: object = { tx_index: "", rpc_address: "" };
|
|
||||||
|
|
||||||
export const DefaultNodeInfoOther = {
|
|
||||||
encode(
|
|
||||||
message: DefaultNodeInfoOther,
|
|
||||||
writer: Writer = Writer.create()
|
|
||||||
): Writer {
|
|
||||||
if (message.tx_index !== "") {
|
|
||||||
writer.uint32(10).string(message.tx_index);
|
|
||||||
}
|
|
||||||
if (message.rpc_address !== "") {
|
|
||||||
writer.uint32(18).string(message.rpc_address);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): DefaultNodeInfoOther {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseDefaultNodeInfoOther } as DefaultNodeInfoOther;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.tx_index = reader.string();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.rpc_address = reader.string();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): DefaultNodeInfoOther {
|
|
||||||
const message = { ...baseDefaultNodeInfoOther } as DefaultNodeInfoOther;
|
|
||||||
if (object.tx_index !== undefined && object.tx_index !== null) {
|
|
||||||
message.tx_index = String(object.tx_index);
|
|
||||||
} else {
|
|
||||||
message.tx_index = "";
|
|
||||||
}
|
|
||||||
if (object.rpc_address !== undefined && object.rpc_address !== null) {
|
|
||||||
message.rpc_address = String(object.rpc_address);
|
|
||||||
} else {
|
|
||||||
message.rpc_address = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: DefaultNodeInfoOther): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.tx_index !== undefined && (obj.tx_index = message.tx_index);
|
|
||||||
message.rpc_address !== undefined &&
|
|
||||||
(obj.rpc_address = message.rpc_address);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<DefaultNodeInfoOther>): DefaultNodeInfoOther {
|
|
||||||
const message = { ...baseDefaultNodeInfoOther } as DefaultNodeInfoOther;
|
|
||||||
if (object.tx_index !== undefined && object.tx_index !== null) {
|
|
||||||
message.tx_index = object.tx_index;
|
|
||||||
} else {
|
|
||||||
message.tx_index = "";
|
|
||||||
}
|
|
||||||
if (object.rpc_address !== undefined && object.rpc_address !== null) {
|
|
||||||
message.rpc_address = object.rpc_address;
|
|
||||||
} else {
|
|
||||||
message.rpc_address = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
declare var self: any | undefined;
|
|
||||||
declare var window: any | undefined;
|
|
||||||
var globalThis: any = (() => {
|
|
||||||
if (typeof globalThis !== "undefined") return globalThis;
|
|
||||||
if (typeof self !== "undefined") return self;
|
|
||||||
if (typeof window !== "undefined") return window;
|
|
||||||
if (typeof global !== "undefined") return global;
|
|
||||||
throw "Unable to locate global object";
|
|
||||||
})();
|
|
||||||
|
|
||||||
const atob: (b64: string) => string =
|
|
||||||
globalThis.atob ||
|
|
||||||
((b64) => globalThis.Buffer.from(b64, "base64").toString("binary"));
|
|
||||||
function bytesFromBase64(b64: string): Uint8Array {
|
|
||||||
const bin = atob(b64);
|
|
||||||
const arr = new Uint8Array(bin.length);
|
|
||||||
for (let i = 0; i < bin.length; ++i) {
|
|
||||||
arr[i] = bin.charCodeAt(i);
|
|
||||||
}
|
|
||||||
return arr;
|
|
||||||
}
|
|
||||||
|
|
||||||
const btoa: (bin: string) => string =
|
|
||||||
globalThis.btoa ||
|
|
||||||
((bin) => globalThis.Buffer.from(bin, "binary").toString("base64"));
|
|
||||||
function base64FromBytes(arr: Uint8Array): string {
|
|
||||||
const bin: string[] = [];
|
|
||||||
for (let i = 0; i < arr.byteLength; ++i) {
|
|
||||||
bin.push(String.fromCharCode(arr[i]));
|
|
||||||
}
|
|
||||||
return btoa(bin.join(""));
|
|
||||||
}
|
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
||||||
export type DeepPartial<T> = T extends Builtin
|
|
||||||
? T
|
|
||||||
: T extends Array<infer U>
|
|
||||||
? Array<DeepPartial<U>>
|
|
||||||
: T extends ReadonlyArray<infer U>
|
|
||||||
? ReadonlyArray<DeepPartial<U>>
|
|
||||||
: T extends {}
|
|
||||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
||||||
: Partial<T>;
|
|
||||||
|
|
||||||
function longToNumber(long: Long): number {
|
|
||||||
if (long.gt(Number.MAX_SAFE_INTEGER)) {
|
|
||||||
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
|
||||||
}
|
|
||||||
return long.toNumber();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (util.Long !== Long) {
|
|
||||||
util.Long = Long as any;
|
|
||||||
configure();
|
|
||||||
}
|
|
|
@ -1,138 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import { Header, Data, Commit } from "../../tendermint/types/types";
|
|
||||||
import { EvidenceList } from "../../tendermint/types/evidence";
|
|
||||||
import { Writer, Reader } from "protobufjs/minimal";
|
|
||||||
|
|
||||||
export const protobufPackage = "tendermint.types";
|
|
||||||
|
|
||||||
export interface Block {
|
|
||||||
header: Header | undefined;
|
|
||||||
data: Data | undefined;
|
|
||||||
evidence: EvidenceList | undefined;
|
|
||||||
last_commit: Commit | undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
const baseBlock: object = {};
|
|
||||||
|
|
||||||
export const Block = {
|
|
||||||
encode(message: Block, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.header !== undefined) {
|
|
||||||
Header.encode(message.header, writer.uint32(10).fork()).ldelim();
|
|
||||||
}
|
|
||||||
if (message.data !== undefined) {
|
|
||||||
Data.encode(message.data, writer.uint32(18).fork()).ldelim();
|
|
||||||
}
|
|
||||||
if (message.evidence !== undefined) {
|
|
||||||
EvidenceList.encode(message.evidence, writer.uint32(26).fork()).ldelim();
|
|
||||||
}
|
|
||||||
if (message.last_commit !== undefined) {
|
|
||||||
Commit.encode(message.last_commit, writer.uint32(34).fork()).ldelim();
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): Block {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseBlock } as Block;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.header = Header.decode(reader, reader.uint32());
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.data = Data.decode(reader, reader.uint32());
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
message.evidence = EvidenceList.decode(reader, reader.uint32());
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
message.last_commit = Commit.decode(reader, reader.uint32());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): Block {
|
|
||||||
const message = { ...baseBlock } as Block;
|
|
||||||
if (object.header !== undefined && object.header !== null) {
|
|
||||||
message.header = Header.fromJSON(object.header);
|
|
||||||
} else {
|
|
||||||
message.header = undefined;
|
|
||||||
}
|
|
||||||
if (object.data !== undefined && object.data !== null) {
|
|
||||||
message.data = Data.fromJSON(object.data);
|
|
||||||
} else {
|
|
||||||
message.data = undefined;
|
|
||||||
}
|
|
||||||
if (object.evidence !== undefined && object.evidence !== null) {
|
|
||||||
message.evidence = EvidenceList.fromJSON(object.evidence);
|
|
||||||
} else {
|
|
||||||
message.evidence = undefined;
|
|
||||||
}
|
|
||||||
if (object.last_commit !== undefined && object.last_commit !== null) {
|
|
||||||
message.last_commit = Commit.fromJSON(object.last_commit);
|
|
||||||
} else {
|
|
||||||
message.last_commit = undefined;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: Block): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.header !== undefined &&
|
|
||||||
(obj.header = message.header ? Header.toJSON(message.header) : undefined);
|
|
||||||
message.data !== undefined &&
|
|
||||||
(obj.data = message.data ? Data.toJSON(message.data) : undefined);
|
|
||||||
message.evidence !== undefined &&
|
|
||||||
(obj.evidence = message.evidence
|
|
||||||
? EvidenceList.toJSON(message.evidence)
|
|
||||||
: undefined);
|
|
||||||
message.last_commit !== undefined &&
|
|
||||||
(obj.last_commit = message.last_commit
|
|
||||||
? Commit.toJSON(message.last_commit)
|
|
||||||
: undefined);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<Block>): Block {
|
|
||||||
const message = { ...baseBlock } as Block;
|
|
||||||
if (object.header !== undefined && object.header !== null) {
|
|
||||||
message.header = Header.fromPartial(object.header);
|
|
||||||
} else {
|
|
||||||
message.header = undefined;
|
|
||||||
}
|
|
||||||
if (object.data !== undefined && object.data !== null) {
|
|
||||||
message.data = Data.fromPartial(object.data);
|
|
||||||
} else {
|
|
||||||
message.data = undefined;
|
|
||||||
}
|
|
||||||
if (object.evidence !== undefined && object.evidence !== null) {
|
|
||||||
message.evidence = EvidenceList.fromPartial(object.evidence);
|
|
||||||
} else {
|
|
||||||
message.evidence = undefined;
|
|
||||||
}
|
|
||||||
if (object.last_commit !== undefined && object.last_commit !== null) {
|
|
||||||
message.last_commit = Commit.fromPartial(object.last_commit);
|
|
||||||
} else {
|
|
||||||
message.last_commit = undefined;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
||||||
export type DeepPartial<T> = T extends Builtin
|
|
||||||
? T
|
|
||||||
: T extends Array<infer U>
|
|
||||||
? Array<DeepPartial<U>>
|
|
||||||
: T extends ReadonlyArray<infer U>
|
|
||||||
? ReadonlyArray<DeepPartial<U>>
|
|
||||||
: T extends {}
|
|
||||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
||||||
: Partial<T>;
|
|
|
@ -1,611 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import { Timestamp } from "../../google/protobuf/timestamp";
|
|
||||||
import * as Long from "long";
|
|
||||||
import { util, configure, Writer, Reader } from "protobufjs/minimal";
|
|
||||||
import { Vote, LightBlock } from "../../tendermint/types/types";
|
|
||||||
import { Validator } from "../../tendermint/types/validator";
|
|
||||||
|
|
||||||
export const protobufPackage = "tendermint.types";
|
|
||||||
|
|
||||||
export interface Evidence {
|
|
||||||
duplicate_vote_evidence: DuplicateVoteEvidence | undefined;
|
|
||||||
light_client_attack_evidence: LightClientAttackEvidence | undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** DuplicateVoteEvidence contains evidence of a validator signed two conflicting votes. */
|
|
||||||
export interface DuplicateVoteEvidence {
|
|
||||||
vote_a: Vote | undefined;
|
|
||||||
vote_b: Vote | undefined;
|
|
||||||
total_voting_power: number;
|
|
||||||
validator_power: number;
|
|
||||||
timestamp: Date | undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** LightClientAttackEvidence contains evidence of a set of validators attempting to mislead a light client. */
|
|
||||||
export interface LightClientAttackEvidence {
|
|
||||||
conflicting_block: LightBlock | undefined;
|
|
||||||
common_height: number;
|
|
||||||
byzantine_validators: Validator[];
|
|
||||||
total_voting_power: number;
|
|
||||||
timestamp: Date | undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface EvidenceList {
|
|
||||||
evidence: Evidence[];
|
|
||||||
}
|
|
||||||
|
|
||||||
const baseEvidence: object = {};
|
|
||||||
|
|
||||||
export const Evidence = {
|
|
||||||
encode(message: Evidence, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.duplicate_vote_evidence !== undefined) {
|
|
||||||
DuplicateVoteEvidence.encode(
|
|
||||||
message.duplicate_vote_evidence,
|
|
||||||
writer.uint32(10).fork()
|
|
||||||
).ldelim();
|
|
||||||
}
|
|
||||||
if (message.light_client_attack_evidence !== undefined) {
|
|
||||||
LightClientAttackEvidence.encode(
|
|
||||||
message.light_client_attack_evidence,
|
|
||||||
writer.uint32(18).fork()
|
|
||||||
).ldelim();
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): Evidence {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseEvidence } as Evidence;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.duplicate_vote_evidence = DuplicateVoteEvidence.decode(
|
|
||||||
reader,
|
|
||||||
reader.uint32()
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.light_client_attack_evidence = LightClientAttackEvidence.decode(
|
|
||||||
reader,
|
|
||||||
reader.uint32()
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): Evidence {
|
|
||||||
const message = { ...baseEvidence } as Evidence;
|
|
||||||
if (
|
|
||||||
object.duplicate_vote_evidence !== undefined &&
|
|
||||||
object.duplicate_vote_evidence !== null
|
|
||||||
) {
|
|
||||||
message.duplicate_vote_evidence = DuplicateVoteEvidence.fromJSON(
|
|
||||||
object.duplicate_vote_evidence
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
message.duplicate_vote_evidence = undefined;
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.light_client_attack_evidence !== undefined &&
|
|
||||||
object.light_client_attack_evidence !== null
|
|
||||||
) {
|
|
||||||
message.light_client_attack_evidence = LightClientAttackEvidence.fromJSON(
|
|
||||||
object.light_client_attack_evidence
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
message.light_client_attack_evidence = undefined;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: Evidence): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.duplicate_vote_evidence !== undefined &&
|
|
||||||
(obj.duplicate_vote_evidence = message.duplicate_vote_evidence
|
|
||||||
? DuplicateVoteEvidence.toJSON(message.duplicate_vote_evidence)
|
|
||||||
: undefined);
|
|
||||||
message.light_client_attack_evidence !== undefined &&
|
|
||||||
(obj.light_client_attack_evidence = message.light_client_attack_evidence
|
|
||||||
? LightClientAttackEvidence.toJSON(message.light_client_attack_evidence)
|
|
||||||
: undefined);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<Evidence>): Evidence {
|
|
||||||
const message = { ...baseEvidence } as Evidence;
|
|
||||||
if (
|
|
||||||
object.duplicate_vote_evidence !== undefined &&
|
|
||||||
object.duplicate_vote_evidence !== null
|
|
||||||
) {
|
|
||||||
message.duplicate_vote_evidence = DuplicateVoteEvidence.fromPartial(
|
|
||||||
object.duplicate_vote_evidence
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
message.duplicate_vote_evidence = undefined;
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.light_client_attack_evidence !== undefined &&
|
|
||||||
object.light_client_attack_evidence !== null
|
|
||||||
) {
|
|
||||||
message.light_client_attack_evidence = LightClientAttackEvidence.fromPartial(
|
|
||||||
object.light_client_attack_evidence
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
message.light_client_attack_evidence = undefined;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseDuplicateVoteEvidence: object = {
|
|
||||||
total_voting_power: 0,
|
|
||||||
validator_power: 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
export const DuplicateVoteEvidence = {
|
|
||||||
encode(
|
|
||||||
message: DuplicateVoteEvidence,
|
|
||||||
writer: Writer = Writer.create()
|
|
||||||
): Writer {
|
|
||||||
if (message.vote_a !== undefined) {
|
|
||||||
Vote.encode(message.vote_a, writer.uint32(10).fork()).ldelim();
|
|
||||||
}
|
|
||||||
if (message.vote_b !== undefined) {
|
|
||||||
Vote.encode(message.vote_b, writer.uint32(18).fork()).ldelim();
|
|
||||||
}
|
|
||||||
if (message.total_voting_power !== 0) {
|
|
||||||
writer.uint32(24).int64(message.total_voting_power);
|
|
||||||
}
|
|
||||||
if (message.validator_power !== 0) {
|
|
||||||
writer.uint32(32).int64(message.validator_power);
|
|
||||||
}
|
|
||||||
if (message.timestamp !== undefined) {
|
|
||||||
Timestamp.encode(
|
|
||||||
toTimestamp(message.timestamp),
|
|
||||||
writer.uint32(42).fork()
|
|
||||||
).ldelim();
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): DuplicateVoteEvidence {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseDuplicateVoteEvidence } as DuplicateVoteEvidence;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.vote_a = Vote.decode(reader, reader.uint32());
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.vote_b = Vote.decode(reader, reader.uint32());
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
message.total_voting_power = longToNumber(reader.int64() as Long);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
message.validator_power = longToNumber(reader.int64() as Long);
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
message.timestamp = fromTimestamp(
|
|
||||||
Timestamp.decode(reader, reader.uint32())
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): DuplicateVoteEvidence {
|
|
||||||
const message = { ...baseDuplicateVoteEvidence } as DuplicateVoteEvidence;
|
|
||||||
if (object.vote_a !== undefined && object.vote_a !== null) {
|
|
||||||
message.vote_a = Vote.fromJSON(object.vote_a);
|
|
||||||
} else {
|
|
||||||
message.vote_a = undefined;
|
|
||||||
}
|
|
||||||
if (object.vote_b !== undefined && object.vote_b !== null) {
|
|
||||||
message.vote_b = Vote.fromJSON(object.vote_b);
|
|
||||||
} else {
|
|
||||||
message.vote_b = undefined;
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.total_voting_power !== undefined &&
|
|
||||||
object.total_voting_power !== null
|
|
||||||
) {
|
|
||||||
message.total_voting_power = Number(object.total_voting_power);
|
|
||||||
} else {
|
|
||||||
message.total_voting_power = 0;
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.validator_power !== undefined &&
|
|
||||||
object.validator_power !== null
|
|
||||||
) {
|
|
||||||
message.validator_power = Number(object.validator_power);
|
|
||||||
} else {
|
|
||||||
message.validator_power = 0;
|
|
||||||
}
|
|
||||||
if (object.timestamp !== undefined && object.timestamp !== null) {
|
|
||||||
message.timestamp = fromJsonTimestamp(object.timestamp);
|
|
||||||
} else {
|
|
||||||
message.timestamp = undefined;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: DuplicateVoteEvidence): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.vote_a !== undefined &&
|
|
||||||
(obj.vote_a = message.vote_a ? Vote.toJSON(message.vote_a) : undefined);
|
|
||||||
message.vote_b !== undefined &&
|
|
||||||
(obj.vote_b = message.vote_b ? Vote.toJSON(message.vote_b) : undefined);
|
|
||||||
message.total_voting_power !== undefined &&
|
|
||||||
(obj.total_voting_power = message.total_voting_power);
|
|
||||||
message.validator_power !== undefined &&
|
|
||||||
(obj.validator_power = message.validator_power);
|
|
||||||
message.timestamp !== undefined &&
|
|
||||||
(obj.timestamp =
|
|
||||||
message.timestamp !== undefined
|
|
||||||
? message.timestamp.toISOString()
|
|
||||||
: null);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(
|
|
||||||
object: DeepPartial<DuplicateVoteEvidence>
|
|
||||||
): DuplicateVoteEvidence {
|
|
||||||
const message = { ...baseDuplicateVoteEvidence } as DuplicateVoteEvidence;
|
|
||||||
if (object.vote_a !== undefined && object.vote_a !== null) {
|
|
||||||
message.vote_a = Vote.fromPartial(object.vote_a);
|
|
||||||
} else {
|
|
||||||
message.vote_a = undefined;
|
|
||||||
}
|
|
||||||
if (object.vote_b !== undefined && object.vote_b !== null) {
|
|
||||||
message.vote_b = Vote.fromPartial(object.vote_b);
|
|
||||||
} else {
|
|
||||||
message.vote_b = undefined;
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.total_voting_power !== undefined &&
|
|
||||||
object.total_voting_power !== null
|
|
||||||
) {
|
|
||||||
message.total_voting_power = object.total_voting_power;
|
|
||||||
} else {
|
|
||||||
message.total_voting_power = 0;
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.validator_power !== undefined &&
|
|
||||||
object.validator_power !== null
|
|
||||||
) {
|
|
||||||
message.validator_power = object.validator_power;
|
|
||||||
} else {
|
|
||||||
message.validator_power = 0;
|
|
||||||
}
|
|
||||||
if (object.timestamp !== undefined && object.timestamp !== null) {
|
|
||||||
message.timestamp = object.timestamp;
|
|
||||||
} else {
|
|
||||||
message.timestamp = undefined;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseLightClientAttackEvidence: object = {
|
|
||||||
common_height: 0,
|
|
||||||
total_voting_power: 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
export const LightClientAttackEvidence = {
|
|
||||||
encode(
|
|
||||||
message: LightClientAttackEvidence,
|
|
||||||
writer: Writer = Writer.create()
|
|
||||||
): Writer {
|
|
||||||
if (message.conflicting_block !== undefined) {
|
|
||||||
LightBlock.encode(
|
|
||||||
message.conflicting_block,
|
|
||||||
writer.uint32(10).fork()
|
|
||||||
).ldelim();
|
|
||||||
}
|
|
||||||
if (message.common_height !== 0) {
|
|
||||||
writer.uint32(16).int64(message.common_height);
|
|
||||||
}
|
|
||||||
for (const v of message.byzantine_validators) {
|
|
||||||
Validator.encode(v!, writer.uint32(26).fork()).ldelim();
|
|
||||||
}
|
|
||||||
if (message.total_voting_power !== 0) {
|
|
||||||
writer.uint32(32).int64(message.total_voting_power);
|
|
||||||
}
|
|
||||||
if (message.timestamp !== undefined) {
|
|
||||||
Timestamp.encode(
|
|
||||||
toTimestamp(message.timestamp),
|
|
||||||
writer.uint32(42).fork()
|
|
||||||
).ldelim();
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(
|
|
||||||
input: Reader | Uint8Array,
|
|
||||||
length?: number
|
|
||||||
): LightClientAttackEvidence {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = {
|
|
||||||
...baseLightClientAttackEvidence,
|
|
||||||
} as LightClientAttackEvidence;
|
|
||||||
message.byzantine_validators = [];
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.conflicting_block = LightBlock.decode(
|
|
||||||
reader,
|
|
||||||
reader.uint32()
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.common_height = longToNumber(reader.int64() as Long);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
message.byzantine_validators.push(
|
|
||||||
Validator.decode(reader, reader.uint32())
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
message.total_voting_power = longToNumber(reader.int64() as Long);
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
message.timestamp = fromTimestamp(
|
|
||||||
Timestamp.decode(reader, reader.uint32())
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): LightClientAttackEvidence {
|
|
||||||
const message = {
|
|
||||||
...baseLightClientAttackEvidence,
|
|
||||||
} as LightClientAttackEvidence;
|
|
||||||
message.byzantine_validators = [];
|
|
||||||
if (
|
|
||||||
object.conflicting_block !== undefined &&
|
|
||||||
object.conflicting_block !== null
|
|
||||||
) {
|
|
||||||
message.conflicting_block = LightBlock.fromJSON(object.conflicting_block);
|
|
||||||
} else {
|
|
||||||
message.conflicting_block = undefined;
|
|
||||||
}
|
|
||||||
if (object.common_height !== undefined && object.common_height !== null) {
|
|
||||||
message.common_height = Number(object.common_height);
|
|
||||||
} else {
|
|
||||||
message.common_height = 0;
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.byzantine_validators !== undefined &&
|
|
||||||
object.byzantine_validators !== null
|
|
||||||
) {
|
|
||||||
for (const e of object.byzantine_validators) {
|
|
||||||
message.byzantine_validators.push(Validator.fromJSON(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.total_voting_power !== undefined &&
|
|
||||||
object.total_voting_power !== null
|
|
||||||
) {
|
|
||||||
message.total_voting_power = Number(object.total_voting_power);
|
|
||||||
} else {
|
|
||||||
message.total_voting_power = 0;
|
|
||||||
}
|
|
||||||
if (object.timestamp !== undefined && object.timestamp !== null) {
|
|
||||||
message.timestamp = fromJsonTimestamp(object.timestamp);
|
|
||||||
} else {
|
|
||||||
message.timestamp = undefined;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: LightClientAttackEvidence): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.conflicting_block !== undefined &&
|
|
||||||
(obj.conflicting_block = message.conflicting_block
|
|
||||||
? LightBlock.toJSON(message.conflicting_block)
|
|
||||||
: undefined);
|
|
||||||
message.common_height !== undefined &&
|
|
||||||
(obj.common_height = message.common_height);
|
|
||||||
if (message.byzantine_validators) {
|
|
||||||
obj.byzantine_validators = message.byzantine_validators.map((e) =>
|
|
||||||
e ? Validator.toJSON(e) : undefined
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
obj.byzantine_validators = [];
|
|
||||||
}
|
|
||||||
message.total_voting_power !== undefined &&
|
|
||||||
(obj.total_voting_power = message.total_voting_power);
|
|
||||||
message.timestamp !== undefined &&
|
|
||||||
(obj.timestamp =
|
|
||||||
message.timestamp !== undefined
|
|
||||||
? message.timestamp.toISOString()
|
|
||||||
: null);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(
|
|
||||||
object: DeepPartial<LightClientAttackEvidence>
|
|
||||||
): LightClientAttackEvidence {
|
|
||||||
const message = {
|
|
||||||
...baseLightClientAttackEvidence,
|
|
||||||
} as LightClientAttackEvidence;
|
|
||||||
message.byzantine_validators = [];
|
|
||||||
if (
|
|
||||||
object.conflicting_block !== undefined &&
|
|
||||||
object.conflicting_block !== null
|
|
||||||
) {
|
|
||||||
message.conflicting_block = LightBlock.fromPartial(
|
|
||||||
object.conflicting_block
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
message.conflicting_block = undefined;
|
|
||||||
}
|
|
||||||
if (object.common_height !== undefined && object.common_height !== null) {
|
|
||||||
message.common_height = object.common_height;
|
|
||||||
} else {
|
|
||||||
message.common_height = 0;
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.byzantine_validators !== undefined &&
|
|
||||||
object.byzantine_validators !== null
|
|
||||||
) {
|
|
||||||
for (const e of object.byzantine_validators) {
|
|
||||||
message.byzantine_validators.push(Validator.fromPartial(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.total_voting_power !== undefined &&
|
|
||||||
object.total_voting_power !== null
|
|
||||||
) {
|
|
||||||
message.total_voting_power = object.total_voting_power;
|
|
||||||
} else {
|
|
||||||
message.total_voting_power = 0;
|
|
||||||
}
|
|
||||||
if (object.timestamp !== undefined && object.timestamp !== null) {
|
|
||||||
message.timestamp = object.timestamp;
|
|
||||||
} else {
|
|
||||||
message.timestamp = undefined;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseEvidenceList: object = {};
|
|
||||||
|
|
||||||
export const EvidenceList = {
|
|
||||||
encode(message: EvidenceList, writer: Writer = Writer.create()): Writer {
|
|
||||||
for (const v of message.evidence) {
|
|
||||||
Evidence.encode(v!, writer.uint32(10).fork()).ldelim();
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): EvidenceList {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseEvidenceList } as EvidenceList;
|
|
||||||
message.evidence = [];
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.evidence.push(Evidence.decode(reader, reader.uint32()));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): EvidenceList {
|
|
||||||
const message = { ...baseEvidenceList } as EvidenceList;
|
|
||||||
message.evidence = [];
|
|
||||||
if (object.evidence !== undefined && object.evidence !== null) {
|
|
||||||
for (const e of object.evidence) {
|
|
||||||
message.evidence.push(Evidence.fromJSON(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: EvidenceList): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
if (message.evidence) {
|
|
||||||
obj.evidence = message.evidence.map((e) =>
|
|
||||||
e ? Evidence.toJSON(e) : undefined
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
obj.evidence = [];
|
|
||||||
}
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<EvidenceList>): EvidenceList {
|
|
||||||
const message = { ...baseEvidenceList } as EvidenceList;
|
|
||||||
message.evidence = [];
|
|
||||||
if (object.evidence !== undefined && object.evidence !== null) {
|
|
||||||
for (const e of object.evidence) {
|
|
||||||
message.evidence.push(Evidence.fromPartial(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
declare var self: any | undefined;
|
|
||||||
declare var window: any | undefined;
|
|
||||||
var globalThis: any = (() => {
|
|
||||||
if (typeof globalThis !== "undefined") return globalThis;
|
|
||||||
if (typeof self !== "undefined") return self;
|
|
||||||
if (typeof window !== "undefined") return window;
|
|
||||||
if (typeof global !== "undefined") return global;
|
|
||||||
throw "Unable to locate global object";
|
|
||||||
})();
|
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
||||||
export type DeepPartial<T> = T extends Builtin
|
|
||||||
? T
|
|
||||||
: T extends Array<infer U>
|
|
||||||
? Array<DeepPartial<U>>
|
|
||||||
: T extends ReadonlyArray<infer U>
|
|
||||||
? ReadonlyArray<DeepPartial<U>>
|
|
||||||
: T extends {}
|
|
||||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
||||||
: Partial<T>;
|
|
||||||
|
|
||||||
function toTimestamp(date: Date): Timestamp {
|
|
||||||
const seconds = date.getTime() / 1_000;
|
|
||||||
const nanos = (date.getTime() % 1_000) * 1_000_000;
|
|
||||||
return { seconds, nanos };
|
|
||||||
}
|
|
||||||
|
|
||||||
function fromTimestamp(t: Timestamp): Date {
|
|
||||||
let millis = t.seconds * 1_000;
|
|
||||||
millis += t.nanos / 1_000_000;
|
|
||||||
return new Date(millis);
|
|
||||||
}
|
|
||||||
|
|
||||||
function fromJsonTimestamp(o: any): Date {
|
|
||||||
if (o instanceof Date) {
|
|
||||||
return o;
|
|
||||||
} else if (typeof o === "string") {
|
|
||||||
return new Date(o);
|
|
||||||
} else {
|
|
||||||
return fromTimestamp(Timestamp.fromJSON(o));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function longToNumber(long: Long): number {
|
|
||||||
if (long.gt(Number.MAX_SAFE_INTEGER)) {
|
|
||||||
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
|
||||||
}
|
|
||||||
return long.toNumber();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (util.Long !== Long) {
|
|
||||||
util.Long = Long as any;
|
|
||||||
configure();
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,382 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import * as Long from "long";
|
|
||||||
import { util, configure, Writer, Reader } from "protobufjs/minimal";
|
|
||||||
import { PublicKey } from "../../tendermint/crypto/keys";
|
|
||||||
|
|
||||||
export const protobufPackage = "tendermint.types";
|
|
||||||
|
|
||||||
export interface ValidatorSet {
|
|
||||||
validators: Validator[];
|
|
||||||
proposer: Validator | undefined;
|
|
||||||
total_voting_power: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Validator {
|
|
||||||
address: Uint8Array;
|
|
||||||
pub_key: PublicKey | undefined;
|
|
||||||
voting_power: number;
|
|
||||||
proposer_priority: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface SimpleValidator {
|
|
||||||
pub_key: PublicKey | undefined;
|
|
||||||
voting_power: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
const baseValidatorSet: object = { total_voting_power: 0 };
|
|
||||||
|
|
||||||
export const ValidatorSet = {
|
|
||||||
encode(message: ValidatorSet, writer: Writer = Writer.create()): Writer {
|
|
||||||
for (const v of message.validators) {
|
|
||||||
Validator.encode(v!, writer.uint32(10).fork()).ldelim();
|
|
||||||
}
|
|
||||||
if (message.proposer !== undefined) {
|
|
||||||
Validator.encode(message.proposer, writer.uint32(18).fork()).ldelim();
|
|
||||||
}
|
|
||||||
if (message.total_voting_power !== 0) {
|
|
||||||
writer.uint32(24).int64(message.total_voting_power);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): ValidatorSet {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseValidatorSet } as ValidatorSet;
|
|
||||||
message.validators = [];
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.validators.push(Validator.decode(reader, reader.uint32()));
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.proposer = Validator.decode(reader, reader.uint32());
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
message.total_voting_power = longToNumber(reader.int64() as Long);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): ValidatorSet {
|
|
||||||
const message = { ...baseValidatorSet } as ValidatorSet;
|
|
||||||
message.validators = [];
|
|
||||||
if (object.validators !== undefined && object.validators !== null) {
|
|
||||||
for (const e of object.validators) {
|
|
||||||
message.validators.push(Validator.fromJSON(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (object.proposer !== undefined && object.proposer !== null) {
|
|
||||||
message.proposer = Validator.fromJSON(object.proposer);
|
|
||||||
} else {
|
|
||||||
message.proposer = undefined;
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.total_voting_power !== undefined &&
|
|
||||||
object.total_voting_power !== null
|
|
||||||
) {
|
|
||||||
message.total_voting_power = Number(object.total_voting_power);
|
|
||||||
} else {
|
|
||||||
message.total_voting_power = 0;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: ValidatorSet): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
if (message.validators) {
|
|
||||||
obj.validators = message.validators.map((e) =>
|
|
||||||
e ? Validator.toJSON(e) : undefined
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
obj.validators = [];
|
|
||||||
}
|
|
||||||
message.proposer !== undefined &&
|
|
||||||
(obj.proposer = message.proposer
|
|
||||||
? Validator.toJSON(message.proposer)
|
|
||||||
: undefined);
|
|
||||||
message.total_voting_power !== undefined &&
|
|
||||||
(obj.total_voting_power = message.total_voting_power);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<ValidatorSet>): ValidatorSet {
|
|
||||||
const message = { ...baseValidatorSet } as ValidatorSet;
|
|
||||||
message.validators = [];
|
|
||||||
if (object.validators !== undefined && object.validators !== null) {
|
|
||||||
for (const e of object.validators) {
|
|
||||||
message.validators.push(Validator.fromPartial(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (object.proposer !== undefined && object.proposer !== null) {
|
|
||||||
message.proposer = Validator.fromPartial(object.proposer);
|
|
||||||
} else {
|
|
||||||
message.proposer = undefined;
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.total_voting_power !== undefined &&
|
|
||||||
object.total_voting_power !== null
|
|
||||||
) {
|
|
||||||
message.total_voting_power = object.total_voting_power;
|
|
||||||
} else {
|
|
||||||
message.total_voting_power = 0;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseValidator: object = { voting_power: 0, proposer_priority: 0 };
|
|
||||||
|
|
||||||
export const Validator = {
|
|
||||||
encode(message: Validator, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.address.length !== 0) {
|
|
||||||
writer.uint32(10).bytes(message.address);
|
|
||||||
}
|
|
||||||
if (message.pub_key !== undefined) {
|
|
||||||
PublicKey.encode(message.pub_key, writer.uint32(18).fork()).ldelim();
|
|
||||||
}
|
|
||||||
if (message.voting_power !== 0) {
|
|
||||||
writer.uint32(24).int64(message.voting_power);
|
|
||||||
}
|
|
||||||
if (message.proposer_priority !== 0) {
|
|
||||||
writer.uint32(32).int64(message.proposer_priority);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): Validator {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseValidator } as Validator;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.address = reader.bytes();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.pub_key = PublicKey.decode(reader, reader.uint32());
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
message.voting_power = longToNumber(reader.int64() as Long);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
message.proposer_priority = longToNumber(reader.int64() as Long);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): Validator {
|
|
||||||
const message = { ...baseValidator } as Validator;
|
|
||||||
if (object.address !== undefined && object.address !== null) {
|
|
||||||
message.address = bytesFromBase64(object.address);
|
|
||||||
}
|
|
||||||
if (object.pub_key !== undefined && object.pub_key !== null) {
|
|
||||||
message.pub_key = PublicKey.fromJSON(object.pub_key);
|
|
||||||
} else {
|
|
||||||
message.pub_key = undefined;
|
|
||||||
}
|
|
||||||
if (object.voting_power !== undefined && object.voting_power !== null) {
|
|
||||||
message.voting_power = Number(object.voting_power);
|
|
||||||
} else {
|
|
||||||
message.voting_power = 0;
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.proposer_priority !== undefined &&
|
|
||||||
object.proposer_priority !== null
|
|
||||||
) {
|
|
||||||
message.proposer_priority = Number(object.proposer_priority);
|
|
||||||
} else {
|
|
||||||
message.proposer_priority = 0;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: Validator): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.address !== undefined &&
|
|
||||||
(obj.address = base64FromBytes(
|
|
||||||
message.address !== undefined ? message.address : new Uint8Array()
|
|
||||||
));
|
|
||||||
message.pub_key !== undefined &&
|
|
||||||
(obj.pub_key = message.pub_key
|
|
||||||
? PublicKey.toJSON(message.pub_key)
|
|
||||||
: undefined);
|
|
||||||
message.voting_power !== undefined &&
|
|
||||||
(obj.voting_power = message.voting_power);
|
|
||||||
message.proposer_priority !== undefined &&
|
|
||||||
(obj.proposer_priority = message.proposer_priority);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<Validator>): Validator {
|
|
||||||
const message = { ...baseValidator } as Validator;
|
|
||||||
if (object.address !== undefined && object.address !== null) {
|
|
||||||
message.address = object.address;
|
|
||||||
} else {
|
|
||||||
message.address = new Uint8Array();
|
|
||||||
}
|
|
||||||
if (object.pub_key !== undefined && object.pub_key !== null) {
|
|
||||||
message.pub_key = PublicKey.fromPartial(object.pub_key);
|
|
||||||
} else {
|
|
||||||
message.pub_key = undefined;
|
|
||||||
}
|
|
||||||
if (object.voting_power !== undefined && object.voting_power !== null) {
|
|
||||||
message.voting_power = object.voting_power;
|
|
||||||
} else {
|
|
||||||
message.voting_power = 0;
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.proposer_priority !== undefined &&
|
|
||||||
object.proposer_priority !== null
|
|
||||||
) {
|
|
||||||
message.proposer_priority = object.proposer_priority;
|
|
||||||
} else {
|
|
||||||
message.proposer_priority = 0;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseSimpleValidator: object = { voting_power: 0 };
|
|
||||||
|
|
||||||
export const SimpleValidator = {
|
|
||||||
encode(message: SimpleValidator, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.pub_key !== undefined) {
|
|
||||||
PublicKey.encode(message.pub_key, writer.uint32(10).fork()).ldelim();
|
|
||||||
}
|
|
||||||
if (message.voting_power !== 0) {
|
|
||||||
writer.uint32(16).int64(message.voting_power);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): SimpleValidator {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseSimpleValidator } as SimpleValidator;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.pub_key = PublicKey.decode(reader, reader.uint32());
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.voting_power = longToNumber(reader.int64() as Long);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): SimpleValidator {
|
|
||||||
const message = { ...baseSimpleValidator } as SimpleValidator;
|
|
||||||
if (object.pub_key !== undefined && object.pub_key !== null) {
|
|
||||||
message.pub_key = PublicKey.fromJSON(object.pub_key);
|
|
||||||
} else {
|
|
||||||
message.pub_key = undefined;
|
|
||||||
}
|
|
||||||
if (object.voting_power !== undefined && object.voting_power !== null) {
|
|
||||||
message.voting_power = Number(object.voting_power);
|
|
||||||
} else {
|
|
||||||
message.voting_power = 0;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: SimpleValidator): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.pub_key !== undefined &&
|
|
||||||
(obj.pub_key = message.pub_key
|
|
||||||
? PublicKey.toJSON(message.pub_key)
|
|
||||||
: undefined);
|
|
||||||
message.voting_power !== undefined &&
|
|
||||||
(obj.voting_power = message.voting_power);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<SimpleValidator>): SimpleValidator {
|
|
||||||
const message = { ...baseSimpleValidator } as SimpleValidator;
|
|
||||||
if (object.pub_key !== undefined && object.pub_key !== null) {
|
|
||||||
message.pub_key = PublicKey.fromPartial(object.pub_key);
|
|
||||||
} else {
|
|
||||||
message.pub_key = undefined;
|
|
||||||
}
|
|
||||||
if (object.voting_power !== undefined && object.voting_power !== null) {
|
|
||||||
message.voting_power = object.voting_power;
|
|
||||||
} else {
|
|
||||||
message.voting_power = 0;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
declare var self: any | undefined;
|
|
||||||
declare var window: any | undefined;
|
|
||||||
var globalThis: any = (() => {
|
|
||||||
if (typeof globalThis !== "undefined") return globalThis;
|
|
||||||
if (typeof self !== "undefined") return self;
|
|
||||||
if (typeof window !== "undefined") return window;
|
|
||||||
if (typeof global !== "undefined") return global;
|
|
||||||
throw "Unable to locate global object";
|
|
||||||
})();
|
|
||||||
|
|
||||||
const atob: (b64: string) => string =
|
|
||||||
globalThis.atob ||
|
|
||||||
((b64) => globalThis.Buffer.from(b64, "base64").toString("binary"));
|
|
||||||
function bytesFromBase64(b64: string): Uint8Array {
|
|
||||||
const bin = atob(b64);
|
|
||||||
const arr = new Uint8Array(bin.length);
|
|
||||||
for (let i = 0; i < bin.length; ++i) {
|
|
||||||
arr[i] = bin.charCodeAt(i);
|
|
||||||
}
|
|
||||||
return arr;
|
|
||||||
}
|
|
||||||
|
|
||||||
const btoa: (bin: string) => string =
|
|
||||||
globalThis.btoa ||
|
|
||||||
((bin) => globalThis.Buffer.from(bin, "binary").toString("base64"));
|
|
||||||
function base64FromBytes(arr: Uint8Array): string {
|
|
||||||
const bin: string[] = [];
|
|
||||||
for (let i = 0; i < arr.byteLength; ++i) {
|
|
||||||
bin.push(String.fromCharCode(arr[i]));
|
|
||||||
}
|
|
||||||
return btoa(bin.join(""));
|
|
||||||
}
|
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
||||||
export type DeepPartial<T> = T extends Builtin
|
|
||||||
? T
|
|
||||||
: T extends Array<infer U>
|
|
||||||
? Array<DeepPartial<U>>
|
|
||||||
: T extends ReadonlyArray<infer U>
|
|
||||||
? ReadonlyArray<DeepPartial<U>>
|
|
||||||
: T extends {}
|
|
||||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
||||||
: Partial<T>;
|
|
||||||
|
|
||||||
function longToNumber(long: Long): number {
|
|
||||||
if (long.gt(Number.MAX_SAFE_INTEGER)) {
|
|
||||||
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
|
||||||
}
|
|
||||||
return long.toNumber();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (util.Long !== Long) {
|
|
||||||
util.Long = Long as any;
|
|
||||||
configure();
|
|
||||||
}
|
|
|
@ -1,202 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import * as Long from "long";
|
|
||||||
import { util, configure, Writer, Reader } from "protobufjs/minimal";
|
|
||||||
|
|
||||||
export const protobufPackage = "tendermint.version";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* App includes the protocol and software version for the application.
|
|
||||||
* This information is included in ResponseInfo. The App.Protocol can be
|
|
||||||
* updated in ResponseEndBlock.
|
|
||||||
*/
|
|
||||||
export interface App {
|
|
||||||
protocol: number;
|
|
||||||
software: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Consensus captures the consensus rules for processing a block in the blockchain,
|
|
||||||
* including all blockchain data structures and the rules of the application's
|
|
||||||
* state transition machine.
|
|
||||||
*/
|
|
||||||
export interface Consensus {
|
|
||||||
block: number;
|
|
||||||
app: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
const baseApp: object = { protocol: 0, software: "" };
|
|
||||||
|
|
||||||
export const App = {
|
|
||||||
encode(message: App, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.protocol !== 0) {
|
|
||||||
writer.uint32(8).uint64(message.protocol);
|
|
||||||
}
|
|
||||||
if (message.software !== "") {
|
|
||||||
writer.uint32(18).string(message.software);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): App {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseApp } as App;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.protocol = longToNumber(reader.uint64() as Long);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.software = reader.string();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): App {
|
|
||||||
const message = { ...baseApp } as App;
|
|
||||||
if (object.protocol !== undefined && object.protocol !== null) {
|
|
||||||
message.protocol = Number(object.protocol);
|
|
||||||
} else {
|
|
||||||
message.protocol = 0;
|
|
||||||
}
|
|
||||||
if (object.software !== undefined && object.software !== null) {
|
|
||||||
message.software = String(object.software);
|
|
||||||
} else {
|
|
||||||
message.software = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: App): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.protocol !== undefined && (obj.protocol = message.protocol);
|
|
||||||
message.software !== undefined && (obj.software = message.software);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<App>): App {
|
|
||||||
const message = { ...baseApp } as App;
|
|
||||||
if (object.protocol !== undefined && object.protocol !== null) {
|
|
||||||
message.protocol = object.protocol;
|
|
||||||
} else {
|
|
||||||
message.protocol = 0;
|
|
||||||
}
|
|
||||||
if (object.software !== undefined && object.software !== null) {
|
|
||||||
message.software = object.software;
|
|
||||||
} else {
|
|
||||||
message.software = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseConsensus: object = { block: 0, app: 0 };
|
|
||||||
|
|
||||||
export const Consensus = {
|
|
||||||
encode(message: Consensus, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.block !== 0) {
|
|
||||||
writer.uint32(8).uint64(message.block);
|
|
||||||
}
|
|
||||||
if (message.app !== 0) {
|
|
||||||
writer.uint32(16).uint64(message.app);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): Consensus {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseConsensus } as Consensus;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.block = longToNumber(reader.uint64() as Long);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.app = longToNumber(reader.uint64() as Long);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): Consensus {
|
|
||||||
const message = { ...baseConsensus } as Consensus;
|
|
||||||
if (object.block !== undefined && object.block !== null) {
|
|
||||||
message.block = Number(object.block);
|
|
||||||
} else {
|
|
||||||
message.block = 0;
|
|
||||||
}
|
|
||||||
if (object.app !== undefined && object.app !== null) {
|
|
||||||
message.app = Number(object.app);
|
|
||||||
} else {
|
|
||||||
message.app = 0;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: Consensus): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.block !== undefined && (obj.block = message.block);
|
|
||||||
message.app !== undefined && (obj.app = message.app);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<Consensus>): Consensus {
|
|
||||||
const message = { ...baseConsensus } as Consensus;
|
|
||||||
if (object.block !== undefined && object.block !== null) {
|
|
||||||
message.block = object.block;
|
|
||||||
} else {
|
|
||||||
message.block = 0;
|
|
||||||
}
|
|
||||||
if (object.app !== undefined && object.app !== null) {
|
|
||||||
message.app = object.app;
|
|
||||||
} else {
|
|
||||||
message.app = 0;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
declare var self: any | undefined;
|
|
||||||
declare var window: any | undefined;
|
|
||||||
var globalThis: any = (() => {
|
|
||||||
if (typeof globalThis !== "undefined") return globalThis;
|
|
||||||
if (typeof self !== "undefined") return self;
|
|
||||||
if (typeof window !== "undefined") return window;
|
|
||||||
if (typeof global !== "undefined") return global;
|
|
||||||
throw "Unable to locate global object";
|
|
||||||
})();
|
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
||||||
export type DeepPartial<T> = T extends Builtin
|
|
||||||
? T
|
|
||||||
: T extends Array<infer U>
|
|
||||||
? Array<DeepPartial<U>>
|
|
||||||
: T extends ReadonlyArray<infer U>
|
|
||||||
? ReadonlyArray<DeepPartial<U>>
|
|
||||||
: T extends {}
|
|
||||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
||||||
: Partial<T>;
|
|
||||||
|
|
||||||
function longToNumber(long: Long): number {
|
|
||||||
if (long.gt(Number.MAX_SAFE_INTEGER)) {
|
|
||||||
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
|
||||||
}
|
|
||||||
return long.toNumber();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (util.Long !== Long) {
|
|
||||||
util.Long = Long as any;
|
|
||||||
configure();
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
{
|
|
||||||
"name": "cosmos-base-tendermint-v1beta1-js",
|
|
||||||
"version": "0.1.0",
|
|
||||||
"description": "Autogenerated vuex store for Cosmos module cosmos.base.tendermint.v1beta1",
|
|
||||||
"author": "Starport Codegen <hello@tendermint.com>",
|
|
||||||
"homepage": "http://github.com/cosmos/cosmos-sdk/client/grpc/tmservice",
|
|
||||||
"license": "Apache-2.0",
|
|
||||||
"licenses": [
|
|
||||||
{
|
|
||||||
"type": "Apache-2.0",
|
|
||||||
"url": "http://www.apache.org/licenses/LICENSE-2.0"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"main": "index.js",
|
|
||||||
"publishConfig": {
|
|
||||||
"access": "public"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
THIS FILE IS GENERATED AUTOMATICALLY. DO NOT DELETE.
|
|
|
@ -1,138 +0,0 @@
|
||||||
import { txClient, queryClient, MissingWalletError , registry} from './module'
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export { };
|
|
||||||
|
|
||||||
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 {
|
|
||||||
|
|
||||||
_Structure: {
|
|
||||||
|
|
||||||
},
|
|
||||||
_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: {
|
|
||||||
|
|
||||||
getTypeStructure: (state) => (type) => {
|
|
||||||
return state._Structure[type].fields
|
|
||||||
},
|
|
||||||
getRegistry: (state) => {
|
|
||||||
return state._Registry
|
|
||||||
}
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
init({ dispatch, rootGetters }) {
|
|
||||||
console.log('Vuex module: cosmos.crisis.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 sendMsgVerifyInvariant({ rootGetters }, { value, fee = [], memo = '' }) {
|
|
||||||
try {
|
|
||||||
const txClient=await initTxClient(rootGetters)
|
|
||||||
const msg = await txClient.msgVerifyInvariant(value)
|
|
||||||
const result = await txClient.signAndBroadcast([msg], {fee: { amount: fee,
|
|
||||||
gas: "200000" }, memo})
|
|
||||||
return result
|
|
||||||
} catch (e) {
|
|
||||||
if (e == MissingWalletError) {
|
|
||||||
throw new Error('TxClient:MsgVerifyInvariant:Init Could not initialize signing client. Wallet is required.')
|
|
||||||
}else{
|
|
||||||
throw new Error('TxClient:MsgVerifyInvariant:Send Could not broadcast Tx: '+ e.message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
async MsgVerifyInvariant({ rootGetters }, { value }) {
|
|
||||||
try {
|
|
||||||
const txClient=await initTxClient(rootGetters)
|
|
||||||
const msg = await txClient.msgVerifyInvariant(value)
|
|
||||||
return msg
|
|
||||||
} catch (e) {
|
|
||||||
if (e == MissingWalletError) {
|
|
||||||
throw new Error('TxClient:MsgVerifyInvariant:Init Could not initialize signing client. Wallet is required.')
|
|
||||||
}else{
|
|
||||||
throw new Error('TxClient:MsgVerifyInvariant:Create Could not create message: ' + e.message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,60 +0,0 @@
|
||||||
// THIS FILE IS GENERATED AUTOMATICALLY. DO NOT MODIFY.
|
|
||||||
|
|
||||||
import { StdFee } from "@cosmjs/launchpad";
|
|
||||||
import { SigningStargateClient } from "@cosmjs/stargate";
|
|
||||||
import { Registry, OfflineSigner, EncodeObject, DirectSecp256k1HdWallet } from "@cosmjs/proto-signing";
|
|
||||||
import { Api } from "./rest";
|
|
||||||
import { MsgVerifyInvariant } from "./types/cosmos/crisis/v1beta1/tx";
|
|
||||||
|
|
||||||
|
|
||||||
const types = [
|
|
||||||
["/cosmos.crisis.v1beta1.MsgVerifyInvariant", MsgVerifyInvariant],
|
|
||||||
|
|
||||||
];
|
|
||||||
export const MissingWalletError = new Error("wallet is required");
|
|
||||||
|
|
||||||
export const registry = new Registry(<any>types);
|
|
||||||
|
|
||||||
const defaultFee = {
|
|
||||||
amount: [],
|
|
||||||
gas: "200000",
|
|
||||||
};
|
|
||||||
|
|
||||||
interface TxClientOptions {
|
|
||||||
addr: string
|
|
||||||
}
|
|
||||||
|
|
||||||
interface SignAndBroadcastOptions {
|
|
||||||
fee: StdFee,
|
|
||||||
memo?: string
|
|
||||||
}
|
|
||||||
|
|
||||||
const txClient = async (wallet: OfflineSigner, { addr: addr }: TxClientOptions = { addr: "http://localhost:26657" }) => {
|
|
||||||
if (!wallet) throw MissingWalletError;
|
|
||||||
let client;
|
|
||||||
if (addr) {
|
|
||||||
client = await SigningStargateClient.connectWithSigner(addr, wallet, { registry });
|
|
||||||
}else{
|
|
||||||
client = await SigningStargateClient.offline( wallet, { registry });
|
|
||||||
}
|
|
||||||
const { address } = (await wallet.getAccounts())[0];
|
|
||||||
|
|
||||||
return {
|
|
||||||
signAndBroadcast: (msgs: EncodeObject[], { fee, memo }: SignAndBroadcastOptions = {fee: defaultFee, memo: ""}) => client.signAndBroadcast(address, msgs, fee,memo),
|
|
||||||
msgVerifyInvariant: (data: MsgVerifyInvariant): EncodeObject => ({ typeUrl: "/cosmos.crisis.v1beta1.MsgVerifyInvariant", value: MsgVerifyInvariant.fromPartial( data ) }),
|
|
||||||
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
interface QueryClientOptions {
|
|
||||||
addr: string
|
|
||||||
}
|
|
||||||
|
|
||||||
const queryClient = async ({ addr: addr }: QueryClientOptions = { addr: "http://localhost:1317" }) => {
|
|
||||||
return new Api({ baseUrl: addr });
|
|
||||||
};
|
|
||||||
|
|
||||||
export {
|
|
||||||
txClient,
|
|
||||||
queryClient,
|
|
||||||
};
|
|
|
@ -1,223 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
/* tslint:disable */
|
|
||||||
/*
|
|
||||||
* ---------------------------------------------------------------
|
|
||||||
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
|
|
||||||
* ## ##
|
|
||||||
* ## AUTHOR: acacode ##
|
|
||||||
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
|
|
||||||
* ---------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
export interface ProtobufAny {
|
|
||||||
"@type"?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface RpcStatus {
|
|
||||||
/** @format int32 */
|
|
||||||
code?: number;
|
|
||||||
message?: string;
|
|
||||||
details?: ProtobufAny[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* MsgVerifyInvariantResponse defines the Msg/VerifyInvariant response type.
|
|
||||||
*/
|
|
||||||
export type V1Beta1MsgVerifyInvariantResponse = object;
|
|
||||||
|
|
||||||
export type QueryParamsType = Record<string | number, any>;
|
|
||||||
export type ResponseFormat = keyof Omit<Body, "body" | "bodyUsed">;
|
|
||||||
|
|
||||||
export interface FullRequestParams extends Omit<RequestInit, "body"> {
|
|
||||||
/** set parameter to `true` for call `securityWorker` for this request */
|
|
||||||
secure?: boolean;
|
|
||||||
/** request path */
|
|
||||||
path: string;
|
|
||||||
/** content type of request body */
|
|
||||||
type?: ContentType;
|
|
||||||
/** query params */
|
|
||||||
query?: QueryParamsType;
|
|
||||||
/** format of response (i.e. response.json() -> format: "json") */
|
|
||||||
format?: keyof Omit<Body, "body" | "bodyUsed">;
|
|
||||||
/** request body */
|
|
||||||
body?: unknown;
|
|
||||||
/** base url */
|
|
||||||
baseUrl?: string;
|
|
||||||
/** request cancellation token */
|
|
||||||
cancelToken?: CancelToken;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type RequestParams = Omit<FullRequestParams, "body" | "method" | "query" | "path">;
|
|
||||||
|
|
||||||
export interface ApiConfig<SecurityDataType = unknown> {
|
|
||||||
baseUrl?: string;
|
|
||||||
baseApiParams?: Omit<RequestParams, "baseUrl" | "cancelToken" | "signal">;
|
|
||||||
securityWorker?: (securityData: SecurityDataType) => RequestParams | void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
|
|
||||||
data: D;
|
|
||||||
error: E;
|
|
||||||
}
|
|
||||||
|
|
||||||
type CancelToken = Symbol | string | number;
|
|
||||||
|
|
||||||
export enum ContentType {
|
|
||||||
Json = "application/json",
|
|
||||||
FormData = "multipart/form-data",
|
|
||||||
UrlEncoded = "application/x-www-form-urlencoded",
|
|
||||||
}
|
|
||||||
|
|
||||||
export class HttpClient<SecurityDataType = unknown> {
|
|
||||||
public baseUrl: string = "";
|
|
||||||
private securityData: SecurityDataType = null as any;
|
|
||||||
private securityWorker: null | ApiConfig<SecurityDataType>["securityWorker"] = null;
|
|
||||||
private abortControllers = new Map<CancelToken, AbortController>();
|
|
||||||
|
|
||||||
private baseApiParams: RequestParams = {
|
|
||||||
credentials: "same-origin",
|
|
||||||
headers: {},
|
|
||||||
redirect: "follow",
|
|
||||||
referrerPolicy: "no-referrer",
|
|
||||||
};
|
|
||||||
|
|
||||||
constructor(apiConfig: ApiConfig<SecurityDataType> = {}) {
|
|
||||||
Object.assign(this, apiConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
public setSecurityData = (data: SecurityDataType) => {
|
|
||||||
this.securityData = data;
|
|
||||||
};
|
|
||||||
|
|
||||||
private addQueryParam(query: QueryParamsType, key: string) {
|
|
||||||
const value = query[key];
|
|
||||||
|
|
||||||
return (
|
|
||||||
encodeURIComponent(key) +
|
|
||||||
"=" +
|
|
||||||
encodeURIComponent(Array.isArray(value) ? value.join(",") : typeof value === "number" ? value : `${value}`)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected toQueryString(rawQuery?: QueryParamsType): string {
|
|
||||||
const query = rawQuery || {};
|
|
||||||
const keys = Object.keys(query).filter((key) => "undefined" !== typeof query[key]);
|
|
||||||
return keys
|
|
||||||
.map((key) =>
|
|
||||||
typeof query[key] === "object" && !Array.isArray(query[key])
|
|
||||||
? this.toQueryString(query[key] as QueryParamsType)
|
|
||||||
: this.addQueryParam(query, key),
|
|
||||||
)
|
|
||||||
.join("&");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected addQueryParams(rawQuery?: QueryParamsType): string {
|
|
||||||
const queryString = this.toQueryString(rawQuery);
|
|
||||||
return queryString ? `?${queryString}` : "";
|
|
||||||
}
|
|
||||||
|
|
||||||
private contentFormatters: Record<ContentType, (input: any) => any> = {
|
|
||||||
[ContentType.Json]: (input: any) =>
|
|
||||||
input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input,
|
|
||||||
[ContentType.FormData]: (input: any) =>
|
|
||||||
Object.keys(input || {}).reduce((data, key) => {
|
|
||||||
data.append(key, input[key]);
|
|
||||||
return data;
|
|
||||||
}, new FormData()),
|
|
||||||
[ContentType.UrlEncoded]: (input: any) => this.toQueryString(input),
|
|
||||||
};
|
|
||||||
|
|
||||||
private mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams {
|
|
||||||
return {
|
|
||||||
...this.baseApiParams,
|
|
||||||
...params1,
|
|
||||||
...(params2 || {}),
|
|
||||||
headers: {
|
|
||||||
...(this.baseApiParams.headers || {}),
|
|
||||||
...(params1.headers || {}),
|
|
||||||
...((params2 && params2.headers) || {}),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private createAbortSignal = (cancelToken: CancelToken): AbortSignal | undefined => {
|
|
||||||
if (this.abortControllers.has(cancelToken)) {
|
|
||||||
const abortController = this.abortControllers.get(cancelToken);
|
|
||||||
if (abortController) {
|
|
||||||
return abortController.signal;
|
|
||||||
}
|
|
||||||
return void 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const abortController = new AbortController();
|
|
||||||
this.abortControllers.set(cancelToken, abortController);
|
|
||||||
return abortController.signal;
|
|
||||||
};
|
|
||||||
|
|
||||||
public abortRequest = (cancelToken: CancelToken) => {
|
|
||||||
const abortController = this.abortControllers.get(cancelToken);
|
|
||||||
|
|
||||||
if (abortController) {
|
|
||||||
abortController.abort();
|
|
||||||
this.abortControllers.delete(cancelToken);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public request = <T = any, E = any>({
|
|
||||||
body,
|
|
||||||
secure,
|
|
||||||
path,
|
|
||||||
type,
|
|
||||||
query,
|
|
||||||
format = "json",
|
|
||||||
baseUrl,
|
|
||||||
cancelToken,
|
|
||||||
...params
|
|
||||||
}: FullRequestParams): Promise<HttpResponse<T, E>> => {
|
|
||||||
const secureParams = (secure && this.securityWorker && this.securityWorker(this.securityData)) || {};
|
|
||||||
const requestParams = this.mergeRequestParams(params, secureParams);
|
|
||||||
const queryString = query && this.toQueryString(query);
|
|
||||||
const payloadFormatter = this.contentFormatters[type || ContentType.Json];
|
|
||||||
|
|
||||||
return fetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, {
|
|
||||||
...requestParams,
|
|
||||||
headers: {
|
|
||||||
...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}),
|
|
||||||
...(requestParams.headers || {}),
|
|
||||||
},
|
|
||||||
signal: cancelToken ? this.createAbortSignal(cancelToken) : void 0,
|
|
||||||
body: typeof body === "undefined" || body === null ? null : payloadFormatter(body),
|
|
||||||
}).then(async (response) => {
|
|
||||||
const r = response as HttpResponse<T, E>;
|
|
||||||
r.data = (null as unknown) as T;
|
|
||||||
r.error = (null as unknown) as E;
|
|
||||||
|
|
||||||
const data = await response[format]()
|
|
||||||
.then((data) => {
|
|
||||||
if (r.ok) {
|
|
||||||
r.data = data;
|
|
||||||
} else {
|
|
||||||
r.error = data;
|
|
||||||
}
|
|
||||||
return r;
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
r.error = e;
|
|
||||||
return r;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (cancelToken) {
|
|
||||||
this.abortControllers.delete(cancelToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!response.ok) throw data;
|
|
||||||
return data;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @title cosmos/crisis/v1beta1/genesis.proto
|
|
||||||
* @version version not set
|
|
||||||
*/
|
|
||||||
export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {}
|
|
|
@ -1,301 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import { Writer, Reader } from "protobufjs/minimal";
|
|
||||||
|
|
||||||
export const protobufPackage = "cosmos.base.v1beta1";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Coin defines a token with a denomination and an amount.
|
|
||||||
*
|
|
||||||
* NOTE: The amount field is an Int which implements the custom method
|
|
||||||
* signatures required by gogoproto.
|
|
||||||
*/
|
|
||||||
export interface Coin {
|
|
||||||
denom: string;
|
|
||||||
amount: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* DecCoin defines a token with a denomination and a decimal amount.
|
|
||||||
*
|
|
||||||
* NOTE: The amount field is an Dec which implements the custom method
|
|
||||||
* signatures required by gogoproto.
|
|
||||||
*/
|
|
||||||
export interface DecCoin {
|
|
||||||
denom: string;
|
|
||||||
amount: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** IntProto defines a Protobuf wrapper around an Int object. */
|
|
||||||
export interface IntProto {
|
|
||||||
int: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** DecProto defines a Protobuf wrapper around a Dec object. */
|
|
||||||
export interface DecProto {
|
|
||||||
dec: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
const baseCoin: object = { denom: "", amount: "" };
|
|
||||||
|
|
||||||
export const Coin = {
|
|
||||||
encode(message: Coin, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.denom !== "") {
|
|
||||||
writer.uint32(10).string(message.denom);
|
|
||||||
}
|
|
||||||
if (message.amount !== "") {
|
|
||||||
writer.uint32(18).string(message.amount);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): Coin {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseCoin } as Coin;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.denom = reader.string();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.amount = reader.string();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): Coin {
|
|
||||||
const message = { ...baseCoin } as Coin;
|
|
||||||
if (object.denom !== undefined && object.denom !== null) {
|
|
||||||
message.denom = String(object.denom);
|
|
||||||
} else {
|
|
||||||
message.denom = "";
|
|
||||||
}
|
|
||||||
if (object.amount !== undefined && object.amount !== null) {
|
|
||||||
message.amount = String(object.amount);
|
|
||||||
} else {
|
|
||||||
message.amount = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: Coin): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.denom !== undefined && (obj.denom = message.denom);
|
|
||||||
message.amount !== undefined && (obj.amount = message.amount);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<Coin>): Coin {
|
|
||||||
const message = { ...baseCoin } as Coin;
|
|
||||||
if (object.denom !== undefined && object.denom !== null) {
|
|
||||||
message.denom = object.denom;
|
|
||||||
} else {
|
|
||||||
message.denom = "";
|
|
||||||
}
|
|
||||||
if (object.amount !== undefined && object.amount !== null) {
|
|
||||||
message.amount = object.amount;
|
|
||||||
} else {
|
|
||||||
message.amount = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseDecCoin: object = { denom: "", amount: "" };
|
|
||||||
|
|
||||||
export const DecCoin = {
|
|
||||||
encode(message: DecCoin, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.denom !== "") {
|
|
||||||
writer.uint32(10).string(message.denom);
|
|
||||||
}
|
|
||||||
if (message.amount !== "") {
|
|
||||||
writer.uint32(18).string(message.amount);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): DecCoin {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseDecCoin } as DecCoin;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.denom = reader.string();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.amount = reader.string();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): DecCoin {
|
|
||||||
const message = { ...baseDecCoin } as DecCoin;
|
|
||||||
if (object.denom !== undefined && object.denom !== null) {
|
|
||||||
message.denom = String(object.denom);
|
|
||||||
} else {
|
|
||||||
message.denom = "";
|
|
||||||
}
|
|
||||||
if (object.amount !== undefined && object.amount !== null) {
|
|
||||||
message.amount = String(object.amount);
|
|
||||||
} else {
|
|
||||||
message.amount = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: DecCoin): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.denom !== undefined && (obj.denom = message.denom);
|
|
||||||
message.amount !== undefined && (obj.amount = message.amount);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<DecCoin>): DecCoin {
|
|
||||||
const message = { ...baseDecCoin } as DecCoin;
|
|
||||||
if (object.denom !== undefined && object.denom !== null) {
|
|
||||||
message.denom = object.denom;
|
|
||||||
} else {
|
|
||||||
message.denom = "";
|
|
||||||
}
|
|
||||||
if (object.amount !== undefined && object.amount !== null) {
|
|
||||||
message.amount = object.amount;
|
|
||||||
} else {
|
|
||||||
message.amount = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseIntProto: object = { int: "" };
|
|
||||||
|
|
||||||
export const IntProto = {
|
|
||||||
encode(message: IntProto, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.int !== "") {
|
|
||||||
writer.uint32(10).string(message.int);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): IntProto {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseIntProto } as IntProto;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.int = reader.string();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): IntProto {
|
|
||||||
const message = { ...baseIntProto } as IntProto;
|
|
||||||
if (object.int !== undefined && object.int !== null) {
|
|
||||||
message.int = String(object.int);
|
|
||||||
} else {
|
|
||||||
message.int = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: IntProto): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.int !== undefined && (obj.int = message.int);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<IntProto>): IntProto {
|
|
||||||
const message = { ...baseIntProto } as IntProto;
|
|
||||||
if (object.int !== undefined && object.int !== null) {
|
|
||||||
message.int = object.int;
|
|
||||||
} else {
|
|
||||||
message.int = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseDecProto: object = { dec: "" };
|
|
||||||
|
|
||||||
export const DecProto = {
|
|
||||||
encode(message: DecProto, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.dec !== "") {
|
|
||||||
writer.uint32(10).string(message.dec);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): DecProto {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseDecProto } as DecProto;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.dec = reader.string();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): DecProto {
|
|
||||||
const message = { ...baseDecProto } as DecProto;
|
|
||||||
if (object.dec !== undefined && object.dec !== null) {
|
|
||||||
message.dec = String(object.dec);
|
|
||||||
} else {
|
|
||||||
message.dec = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: DecProto): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.dec !== undefined && (obj.dec = message.dec);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<DecProto>): DecProto {
|
|
||||||
const message = { ...baseDecProto } as DecProto;
|
|
||||||
if (object.dec !== undefined && object.dec !== null) {
|
|
||||||
message.dec = object.dec;
|
|
||||||
} else {
|
|
||||||
message.dec = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
||||||
export type DeepPartial<T> = T extends Builtin
|
|
||||||
? T
|
|
||||||
: T extends Array<infer U>
|
|
||||||
? Array<DeepPartial<U>>
|
|
||||||
: T extends ReadonlyArray<infer U>
|
|
||||||
? ReadonlyArray<DeepPartial<U>>
|
|
||||||
: T extends {}
|
|
||||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
||||||
: Partial<T>;
|
|
|
@ -1,83 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import { Coin } from "../../../cosmos/base/v1beta1/coin";
|
|
||||||
import { Writer, Reader } from "protobufjs/minimal";
|
|
||||||
|
|
||||||
export const protobufPackage = "cosmos.crisis.v1beta1";
|
|
||||||
|
|
||||||
/** GenesisState defines the crisis module's genesis state. */
|
|
||||||
export interface GenesisState {
|
|
||||||
/**
|
|
||||||
* constant_fee is the fee used to verify the invariant in the crisis
|
|
||||||
* module.
|
|
||||||
*/
|
|
||||||
constant_fee: Coin | undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
const baseGenesisState: object = {};
|
|
||||||
|
|
||||||
export const GenesisState = {
|
|
||||||
encode(message: GenesisState, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.constant_fee !== undefined) {
|
|
||||||
Coin.encode(message.constant_fee, writer.uint32(26).fork()).ldelim();
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): GenesisState {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseGenesisState } as GenesisState;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 3:
|
|
||||||
message.constant_fee = Coin.decode(reader, reader.uint32());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): GenesisState {
|
|
||||||
const message = { ...baseGenesisState } as GenesisState;
|
|
||||||
if (object.constant_fee !== undefined && object.constant_fee !== null) {
|
|
||||||
message.constant_fee = Coin.fromJSON(object.constant_fee);
|
|
||||||
} else {
|
|
||||||
message.constant_fee = undefined;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: GenesisState): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.constant_fee !== undefined &&
|
|
||||||
(obj.constant_fee = message.constant_fee
|
|
||||||
? Coin.toJSON(message.constant_fee)
|
|
||||||
: undefined);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<GenesisState>): GenesisState {
|
|
||||||
const message = { ...baseGenesisState } as GenesisState;
|
|
||||||
if (object.constant_fee !== undefined && object.constant_fee !== null) {
|
|
||||||
message.constant_fee = Coin.fromPartial(object.constant_fee);
|
|
||||||
} else {
|
|
||||||
message.constant_fee = undefined;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
||||||
export type DeepPartial<T> = T extends Builtin
|
|
||||||
? T
|
|
||||||
: T extends Array<infer U>
|
|
||||||
? Array<DeepPartial<U>>
|
|
||||||
: T extends ReadonlyArray<infer U>
|
|
||||||
? ReadonlyArray<DeepPartial<U>>
|
|
||||||
: T extends {}
|
|
||||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
||||||
: Partial<T>;
|
|
|
@ -1,223 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import { Reader, Writer } from "protobufjs/minimal";
|
|
||||||
|
|
||||||
export const protobufPackage = "cosmos.crisis.v1beta1";
|
|
||||||
|
|
||||||
/** MsgVerifyInvariant represents a message to verify a particular invariance. */
|
|
||||||
export interface MsgVerifyInvariant {
|
|
||||||
sender: string;
|
|
||||||
invariant_module_name: string;
|
|
||||||
invariant_route: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** MsgVerifyInvariantResponse defines the Msg/VerifyInvariant response type. */
|
|
||||||
export interface MsgVerifyInvariantResponse {}
|
|
||||||
|
|
||||||
const baseMsgVerifyInvariant: object = {
|
|
||||||
sender: "",
|
|
||||||
invariant_module_name: "",
|
|
||||||
invariant_route: "",
|
|
||||||
};
|
|
||||||
|
|
||||||
export const MsgVerifyInvariant = {
|
|
||||||
encode(
|
|
||||||
message: MsgVerifyInvariant,
|
|
||||||
writer: Writer = Writer.create()
|
|
||||||
): Writer {
|
|
||||||
if (message.sender !== "") {
|
|
||||||
writer.uint32(10).string(message.sender);
|
|
||||||
}
|
|
||||||
if (message.invariant_module_name !== "") {
|
|
||||||
writer.uint32(18).string(message.invariant_module_name);
|
|
||||||
}
|
|
||||||
if (message.invariant_route !== "") {
|
|
||||||
writer.uint32(26).string(message.invariant_route);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): MsgVerifyInvariant {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseMsgVerifyInvariant } as MsgVerifyInvariant;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.sender = reader.string();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.invariant_module_name = reader.string();
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
message.invariant_route = reader.string();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): MsgVerifyInvariant {
|
|
||||||
const message = { ...baseMsgVerifyInvariant } as MsgVerifyInvariant;
|
|
||||||
if (object.sender !== undefined && object.sender !== null) {
|
|
||||||
message.sender = String(object.sender);
|
|
||||||
} else {
|
|
||||||
message.sender = "";
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.invariant_module_name !== undefined &&
|
|
||||||
object.invariant_module_name !== null
|
|
||||||
) {
|
|
||||||
message.invariant_module_name = String(object.invariant_module_name);
|
|
||||||
} else {
|
|
||||||
message.invariant_module_name = "";
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.invariant_route !== undefined &&
|
|
||||||
object.invariant_route !== null
|
|
||||||
) {
|
|
||||||
message.invariant_route = String(object.invariant_route);
|
|
||||||
} else {
|
|
||||||
message.invariant_route = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: MsgVerifyInvariant): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.sender !== undefined && (obj.sender = message.sender);
|
|
||||||
message.invariant_module_name !== undefined &&
|
|
||||||
(obj.invariant_module_name = message.invariant_module_name);
|
|
||||||
message.invariant_route !== undefined &&
|
|
||||||
(obj.invariant_route = message.invariant_route);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<MsgVerifyInvariant>): MsgVerifyInvariant {
|
|
||||||
const message = { ...baseMsgVerifyInvariant } as MsgVerifyInvariant;
|
|
||||||
if (object.sender !== undefined && object.sender !== null) {
|
|
||||||
message.sender = object.sender;
|
|
||||||
} else {
|
|
||||||
message.sender = "";
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.invariant_module_name !== undefined &&
|
|
||||||
object.invariant_module_name !== null
|
|
||||||
) {
|
|
||||||
message.invariant_module_name = object.invariant_module_name;
|
|
||||||
} else {
|
|
||||||
message.invariant_module_name = "";
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.invariant_route !== undefined &&
|
|
||||||
object.invariant_route !== null
|
|
||||||
) {
|
|
||||||
message.invariant_route = object.invariant_route;
|
|
||||||
} else {
|
|
||||||
message.invariant_route = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseMsgVerifyInvariantResponse: object = {};
|
|
||||||
|
|
||||||
export const MsgVerifyInvariantResponse = {
|
|
||||||
encode(
|
|
||||||
_: MsgVerifyInvariantResponse,
|
|
||||||
writer: Writer = Writer.create()
|
|
||||||
): Writer {
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(
|
|
||||||
input: Reader | Uint8Array,
|
|
||||||
length?: number
|
|
||||||
): MsgVerifyInvariantResponse {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = {
|
|
||||||
...baseMsgVerifyInvariantResponse,
|
|
||||||
} as MsgVerifyInvariantResponse;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(_: any): MsgVerifyInvariantResponse {
|
|
||||||
const message = {
|
|
||||||
...baseMsgVerifyInvariantResponse,
|
|
||||||
} as MsgVerifyInvariantResponse;
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(_: MsgVerifyInvariantResponse): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(
|
|
||||||
_: DeepPartial<MsgVerifyInvariantResponse>
|
|
||||||
): MsgVerifyInvariantResponse {
|
|
||||||
const message = {
|
|
||||||
...baseMsgVerifyInvariantResponse,
|
|
||||||
} as MsgVerifyInvariantResponse;
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
/** Msg defines the bank Msg service. */
|
|
||||||
export interface Msg {
|
|
||||||
/** VerifyInvariant defines a method to verify a particular invariance. */
|
|
||||||
VerifyInvariant(
|
|
||||||
request: MsgVerifyInvariant
|
|
||||||
): Promise<MsgVerifyInvariantResponse>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class MsgClientImpl implements Msg {
|
|
||||||
private readonly rpc: Rpc;
|
|
||||||
constructor(rpc: Rpc) {
|
|
||||||
this.rpc = rpc;
|
|
||||||
}
|
|
||||||
VerifyInvariant(
|
|
||||||
request: MsgVerifyInvariant
|
|
||||||
): Promise<MsgVerifyInvariantResponse> {
|
|
||||||
const data = MsgVerifyInvariant.encode(request).finish();
|
|
||||||
const promise = this.rpc.request(
|
|
||||||
"cosmos.crisis.v1beta1.Msg",
|
|
||||||
"VerifyInvariant",
|
|
||||||
data
|
|
||||||
);
|
|
||||||
return promise.then((data) =>
|
|
||||||
MsgVerifyInvariantResponse.decode(new Reader(data))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Rpc {
|
|
||||||
request(
|
|
||||||
service: string,
|
|
||||||
method: string,
|
|
||||||
data: Uint8Array
|
|
||||||
): Promise<Uint8Array>;
|
|
||||||
}
|
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
||||||
export type DeepPartial<T> = T extends Builtin
|
|
||||||
? T
|
|
||||||
: T extends Array<infer U>
|
|
||||||
? Array<DeepPartial<U>>
|
|
||||||
: T extends ReadonlyArray<infer U>
|
|
||||||
? ReadonlyArray<DeepPartial<U>>
|
|
||||||
: T extends {}
|
|
||||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
||||||
: Partial<T>;
|
|
|
@ -1,2 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
export const protobufPackage = "gogoproto";
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,18 +0,0 @@
|
||||||
{
|
|
||||||
"name": "cosmos-crisis-v1beta1-js",
|
|
||||||
"version": "0.1.0",
|
|
||||||
"description": "Autogenerated vuex store for Cosmos module cosmos.crisis.v1beta1",
|
|
||||||
"author": "Starport Codegen <hello@tendermint.com>",
|
|
||||||
"homepage": "http://github.com/cosmos/cosmos-sdk/x/crisis/types",
|
|
||||||
"license": "Apache-2.0",
|
|
||||||
"licenses": [
|
|
||||||
{
|
|
||||||
"type": "Apache-2.0",
|
|
||||||
"url": "http://www.apache.org/licenses/LICENSE-2.0"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"main": "index.js",
|
|
||||||
"publishConfig": {
|
|
||||||
"access": "public"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
THIS FILE IS GENERATED AUTOMATICALLY. DO NOT DELETE.
|
|
|
@ -1,525 +0,0 @@
|
||||||
import { txClient, queryClient, MissingWalletError , registry} from './module'
|
|
||||||
|
|
||||||
import { Params } from "./module/types/cosmos/distribution/v1beta1/distribution"
|
|
||||||
import { ValidatorHistoricalRewards } from "./module/types/cosmos/distribution/v1beta1/distribution"
|
|
||||||
import { ValidatorCurrentRewards } from "./module/types/cosmos/distribution/v1beta1/distribution"
|
|
||||||
import { ValidatorAccumulatedCommission } from "./module/types/cosmos/distribution/v1beta1/distribution"
|
|
||||||
import { ValidatorOutstandingRewards } from "./module/types/cosmos/distribution/v1beta1/distribution"
|
|
||||||
import { ValidatorSlashEvent } from "./module/types/cosmos/distribution/v1beta1/distribution"
|
|
||||||
import { ValidatorSlashEvents } from "./module/types/cosmos/distribution/v1beta1/distribution"
|
|
||||||
import { FeePool } from "./module/types/cosmos/distribution/v1beta1/distribution"
|
|
||||||
import { CommunityPoolSpendProposal } from "./module/types/cosmos/distribution/v1beta1/distribution"
|
|
||||||
import { DelegatorStartingInfo } from "./module/types/cosmos/distribution/v1beta1/distribution"
|
|
||||||
import { DelegationDelegatorReward } from "./module/types/cosmos/distribution/v1beta1/distribution"
|
|
||||||
import { CommunityPoolSpendProposalWithDeposit } from "./module/types/cosmos/distribution/v1beta1/distribution"
|
|
||||||
import { DelegatorWithdrawInfo } from "./module/types/cosmos/distribution/v1beta1/genesis"
|
|
||||||
import { ValidatorOutstandingRewardsRecord } from "./module/types/cosmos/distribution/v1beta1/genesis"
|
|
||||||
import { ValidatorAccumulatedCommissionRecord } from "./module/types/cosmos/distribution/v1beta1/genesis"
|
|
||||||
import { ValidatorHistoricalRewardsRecord } from "./module/types/cosmos/distribution/v1beta1/genesis"
|
|
||||||
import { ValidatorCurrentRewardsRecord } from "./module/types/cosmos/distribution/v1beta1/genesis"
|
|
||||||
import { DelegatorStartingInfoRecord } from "./module/types/cosmos/distribution/v1beta1/genesis"
|
|
||||||
import { ValidatorSlashEventRecord } from "./module/types/cosmos/distribution/v1beta1/genesis"
|
|
||||||
|
|
||||||
|
|
||||||
export { Params, ValidatorHistoricalRewards, ValidatorCurrentRewards, ValidatorAccumulatedCommission, ValidatorOutstandingRewards, ValidatorSlashEvent, ValidatorSlashEvents, FeePool, CommunityPoolSpendProposal, DelegatorStartingInfo, DelegationDelegatorReward, CommunityPoolSpendProposalWithDeposit, DelegatorWithdrawInfo, ValidatorOutstandingRewardsRecord, ValidatorAccumulatedCommissionRecord, ValidatorHistoricalRewardsRecord, ValidatorCurrentRewardsRecord, DelegatorStartingInfoRecord, ValidatorSlashEventRecord };
|
|
||||||
|
|
||||||
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: {},
|
|
||||||
ValidatorOutstandingRewards: {},
|
|
||||||
ValidatorCommission: {},
|
|
||||||
ValidatorSlashes: {},
|
|
||||||
DelegationRewards: {},
|
|
||||||
DelegationTotalRewards: {},
|
|
||||||
DelegatorValidators: {},
|
|
||||||
DelegatorWithdrawAddress: {},
|
|
||||||
CommunityPool: {},
|
|
||||||
|
|
||||||
_Structure: {
|
|
||||||
Params: getStructure(Params.fromPartial({})),
|
|
||||||
ValidatorHistoricalRewards: getStructure(ValidatorHistoricalRewards.fromPartial({})),
|
|
||||||
ValidatorCurrentRewards: getStructure(ValidatorCurrentRewards.fromPartial({})),
|
|
||||||
ValidatorAccumulatedCommission: getStructure(ValidatorAccumulatedCommission.fromPartial({})),
|
|
||||||
ValidatorOutstandingRewards: getStructure(ValidatorOutstandingRewards.fromPartial({})),
|
|
||||||
ValidatorSlashEvent: getStructure(ValidatorSlashEvent.fromPartial({})),
|
|
||||||
ValidatorSlashEvents: getStructure(ValidatorSlashEvents.fromPartial({})),
|
|
||||||
FeePool: getStructure(FeePool.fromPartial({})),
|
|
||||||
CommunityPoolSpendProposal: getStructure(CommunityPoolSpendProposal.fromPartial({})),
|
|
||||||
DelegatorStartingInfo: getStructure(DelegatorStartingInfo.fromPartial({})),
|
|
||||||
DelegationDelegatorReward: getStructure(DelegationDelegatorReward.fromPartial({})),
|
|
||||||
CommunityPoolSpendProposalWithDeposit: getStructure(CommunityPoolSpendProposalWithDeposit.fromPartial({})),
|
|
||||||
DelegatorWithdrawInfo: getStructure(DelegatorWithdrawInfo.fromPartial({})),
|
|
||||||
ValidatorOutstandingRewardsRecord: getStructure(ValidatorOutstandingRewardsRecord.fromPartial({})),
|
|
||||||
ValidatorAccumulatedCommissionRecord: getStructure(ValidatorAccumulatedCommissionRecord.fromPartial({})),
|
|
||||||
ValidatorHistoricalRewardsRecord: getStructure(ValidatorHistoricalRewardsRecord.fromPartial({})),
|
|
||||||
ValidatorCurrentRewardsRecord: getStructure(ValidatorCurrentRewardsRecord.fromPartial({})),
|
|
||||||
DelegatorStartingInfoRecord: getStructure(DelegatorStartingInfoRecord.fromPartial({})),
|
|
||||||
ValidatorSlashEventRecord: getStructure(ValidatorSlashEventRecord.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 (!(<any> params).query) {
|
|
||||||
(<any> params).query=null
|
|
||||||
}
|
|
||||||
return state.Params[JSON.stringify(params)] ?? {}
|
|
||||||
},
|
|
||||||
getValidatorOutstandingRewards: (state) => (params = { params: {}}) => {
|
|
||||||
if (!(<any> params).query) {
|
|
||||||
(<any> params).query=null
|
|
||||||
}
|
|
||||||
return state.ValidatorOutstandingRewards[JSON.stringify(params)] ?? {}
|
|
||||||
},
|
|
||||||
getValidatorCommission: (state) => (params = { params: {}}) => {
|
|
||||||
if (!(<any> params).query) {
|
|
||||||
(<any> params).query=null
|
|
||||||
}
|
|
||||||
return state.ValidatorCommission[JSON.stringify(params)] ?? {}
|
|
||||||
},
|
|
||||||
getValidatorSlashes: (state) => (params = { params: {}}) => {
|
|
||||||
if (!(<any> params).query) {
|
|
||||||
(<any> params).query=null
|
|
||||||
}
|
|
||||||
return state.ValidatorSlashes[JSON.stringify(params)] ?? {}
|
|
||||||
},
|
|
||||||
getDelegationRewards: (state) => (params = { params: {}}) => {
|
|
||||||
if (!(<any> params).query) {
|
|
||||||
(<any> params).query=null
|
|
||||||
}
|
|
||||||
return state.DelegationRewards[JSON.stringify(params)] ?? {}
|
|
||||||
},
|
|
||||||
getDelegationTotalRewards: (state) => (params = { params: {}}) => {
|
|
||||||
if (!(<any> params).query) {
|
|
||||||
(<any> params).query=null
|
|
||||||
}
|
|
||||||
return state.DelegationTotalRewards[JSON.stringify(params)] ?? {}
|
|
||||||
},
|
|
||||||
getDelegatorValidators: (state) => (params = { params: {}}) => {
|
|
||||||
if (!(<any> params).query) {
|
|
||||||
(<any> params).query=null
|
|
||||||
}
|
|
||||||
return state.DelegatorValidators[JSON.stringify(params)] ?? {}
|
|
||||||
},
|
|
||||||
getDelegatorWithdrawAddress: (state) => (params = { params: {}}) => {
|
|
||||||
if (!(<any> params).query) {
|
|
||||||
(<any> params).query=null
|
|
||||||
}
|
|
||||||
return state.DelegatorWithdrawAddress[JSON.stringify(params)] ?? {}
|
|
||||||
},
|
|
||||||
getCommunityPool: (state) => (params = { params: {}}) => {
|
|
||||||
if (!(<any> params).query) {
|
|
||||||
(<any> params).query=null
|
|
||||||
}
|
|
||||||
return state.CommunityPool[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.distribution.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 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 Error('QueryClient:QueryParams API Node Unavailable. Could not perform query: ' + e.message)
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async QueryValidatorOutstandingRewards({ 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.queryValidatorOutstandingRewards( key.validator_address)).data
|
|
||||||
|
|
||||||
|
|
||||||
commit('QUERY', { query: 'ValidatorOutstandingRewards', key: { params: {...key}, query}, value })
|
|
||||||
if (subscribe) commit('SUBSCRIBE', { action: 'QueryValidatorOutstandingRewards', payload: { options: { all }, params: {...key},query }})
|
|
||||||
return getters['getValidatorOutstandingRewards']( { params: {...key}, query}) ?? {}
|
|
||||||
} catch (e) {
|
|
||||||
throw new Error('QueryClient:QueryValidatorOutstandingRewards API Node Unavailable. Could not perform query: ' + e.message)
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async QueryValidatorCommission({ 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.queryValidatorCommission( key.validator_address)).data
|
|
||||||
|
|
||||||
|
|
||||||
commit('QUERY', { query: 'ValidatorCommission', key: { params: {...key}, query}, value })
|
|
||||||
if (subscribe) commit('SUBSCRIBE', { action: 'QueryValidatorCommission', payload: { options: { all }, params: {...key},query }})
|
|
||||||
return getters['getValidatorCommission']( { params: {...key}, query}) ?? {}
|
|
||||||
} catch (e) {
|
|
||||||
throw new Error('QueryClient:QueryValidatorCommission API Node Unavailable. Could not perform query: ' + e.message)
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async QueryValidatorSlashes({ 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.queryValidatorSlashes( key.validator_address, query)).data
|
|
||||||
|
|
||||||
|
|
||||||
while (all && (<any> value).pagination && (<any> value).pagination.next_key!=null) {
|
|
||||||
let next_values=(await queryClient.queryValidatorSlashes( key.validator_address, {...query, 'pagination.key':(<any> value).pagination.next_key})).data
|
|
||||||
value = mergeResults(value, next_values);
|
|
||||||
}
|
|
||||||
commit('QUERY', { query: 'ValidatorSlashes', key: { params: {...key}, query}, value })
|
|
||||||
if (subscribe) commit('SUBSCRIBE', { action: 'QueryValidatorSlashes', payload: { options: { all }, params: {...key},query }})
|
|
||||||
return getters['getValidatorSlashes']( { params: {...key}, query}) ?? {}
|
|
||||||
} catch (e) {
|
|
||||||
throw new Error('QueryClient:QueryValidatorSlashes API Node Unavailable. Could not perform query: ' + e.message)
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async QueryDelegationRewards({ 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.queryDelegationRewards( key.delegator_address, key.validator_address)).data
|
|
||||||
|
|
||||||
|
|
||||||
commit('QUERY', { query: 'DelegationRewards', key: { params: {...key}, query}, value })
|
|
||||||
if (subscribe) commit('SUBSCRIBE', { action: 'QueryDelegationRewards', payload: { options: { all }, params: {...key},query }})
|
|
||||||
return getters['getDelegationRewards']( { params: {...key}, query}) ?? {}
|
|
||||||
} catch (e) {
|
|
||||||
throw new Error('QueryClient:QueryDelegationRewards API Node Unavailable. Could not perform query: ' + e.message)
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async QueryDelegationTotalRewards({ 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.queryDelegationTotalRewards( key.delegator_address)).data
|
|
||||||
|
|
||||||
|
|
||||||
commit('QUERY', { query: 'DelegationTotalRewards', key: { params: {...key}, query}, value })
|
|
||||||
if (subscribe) commit('SUBSCRIBE', { action: 'QueryDelegationTotalRewards', payload: { options: { all }, params: {...key},query }})
|
|
||||||
return getters['getDelegationTotalRewards']( { params: {...key}, query}) ?? {}
|
|
||||||
} catch (e) {
|
|
||||||
throw new Error('QueryClient:QueryDelegationTotalRewards API Node Unavailable. Could not perform query: ' + e.message)
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async QueryDelegatorValidators({ 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.queryDelegatorValidators( key.delegator_address)).data
|
|
||||||
|
|
||||||
|
|
||||||
commit('QUERY', { query: 'DelegatorValidators', key: { params: {...key}, query}, value })
|
|
||||||
if (subscribe) commit('SUBSCRIBE', { action: 'QueryDelegatorValidators', payload: { options: { all }, params: {...key},query }})
|
|
||||||
return getters['getDelegatorValidators']( { params: {...key}, query}) ?? {}
|
|
||||||
} catch (e) {
|
|
||||||
throw new Error('QueryClient:QueryDelegatorValidators API Node Unavailable. Could not perform query: ' + e.message)
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async QueryDelegatorWithdrawAddress({ 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.queryDelegatorWithdrawAddress( key.delegator_address)).data
|
|
||||||
|
|
||||||
|
|
||||||
commit('QUERY', { query: 'DelegatorWithdrawAddress', key: { params: {...key}, query}, value })
|
|
||||||
if (subscribe) commit('SUBSCRIBE', { action: 'QueryDelegatorWithdrawAddress', payload: { options: { all }, params: {...key},query }})
|
|
||||||
return getters['getDelegatorWithdrawAddress']( { params: {...key}, query}) ?? {}
|
|
||||||
} catch (e) {
|
|
||||||
throw new Error('QueryClient:QueryDelegatorWithdrawAddress API Node Unavailable. Could not perform query: ' + e.message)
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async QueryCommunityPool({ 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.queryCommunityPool()).data
|
|
||||||
|
|
||||||
|
|
||||||
commit('QUERY', { query: 'CommunityPool', key: { params: {...key}, query}, value })
|
|
||||||
if (subscribe) commit('SUBSCRIBE', { action: 'QueryCommunityPool', payload: { options: { all }, params: {...key},query }})
|
|
||||||
return getters['getCommunityPool']( { params: {...key}, query}) ?? {}
|
|
||||||
} catch (e) {
|
|
||||||
throw new Error('QueryClient:QueryCommunityPool API Node Unavailable. Could not perform query: ' + e.message)
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
async sendMsgWithdrawValidatorCommission({ rootGetters }, { value, fee = [], memo = '' }) {
|
|
||||||
try {
|
|
||||||
const txClient=await initTxClient(rootGetters)
|
|
||||||
const msg = await txClient.msgWithdrawValidatorCommission(value)
|
|
||||||
const result = await txClient.signAndBroadcast([msg], {fee: { amount: fee,
|
|
||||||
gas: "200000" }, memo})
|
|
||||||
return result
|
|
||||||
} catch (e) {
|
|
||||||
if (e == MissingWalletError) {
|
|
||||||
throw new Error('TxClient:MsgWithdrawValidatorCommission:Init Could not initialize signing client. Wallet is required.')
|
|
||||||
}else{
|
|
||||||
throw new Error('TxClient:MsgWithdrawValidatorCommission:Send Could not broadcast Tx: '+ e.message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async sendMsgWithdrawDelegatorReward({ rootGetters }, { value, fee = [], memo = '' }) {
|
|
||||||
try {
|
|
||||||
const txClient=await initTxClient(rootGetters)
|
|
||||||
const msg = await txClient.msgWithdrawDelegatorReward(value)
|
|
||||||
const result = await txClient.signAndBroadcast([msg], {fee: { amount: fee,
|
|
||||||
gas: "200000" }, memo})
|
|
||||||
return result
|
|
||||||
} catch (e) {
|
|
||||||
if (e == MissingWalletError) {
|
|
||||||
throw new Error('TxClient:MsgWithdrawDelegatorReward:Init Could not initialize signing client. Wallet is required.')
|
|
||||||
}else{
|
|
||||||
throw new Error('TxClient:MsgWithdrawDelegatorReward:Send Could not broadcast Tx: '+ e.message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async sendMsgSetWithdrawAddress({ rootGetters }, { value, fee = [], memo = '' }) {
|
|
||||||
try {
|
|
||||||
const txClient=await initTxClient(rootGetters)
|
|
||||||
const msg = await txClient.msgSetWithdrawAddress(value)
|
|
||||||
const result = await txClient.signAndBroadcast([msg], {fee: { amount: fee,
|
|
||||||
gas: "200000" }, memo})
|
|
||||||
return result
|
|
||||||
} catch (e) {
|
|
||||||
if (e == MissingWalletError) {
|
|
||||||
throw new Error('TxClient:MsgSetWithdrawAddress:Init Could not initialize signing client. Wallet is required.')
|
|
||||||
}else{
|
|
||||||
throw new Error('TxClient:MsgSetWithdrawAddress:Send Could not broadcast Tx: '+ e.message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async sendMsgFundCommunityPool({ rootGetters }, { value, fee = [], memo = '' }) {
|
|
||||||
try {
|
|
||||||
const txClient=await initTxClient(rootGetters)
|
|
||||||
const msg = await txClient.msgFundCommunityPool(value)
|
|
||||||
const result = await txClient.signAndBroadcast([msg], {fee: { amount: fee,
|
|
||||||
gas: "200000" }, memo})
|
|
||||||
return result
|
|
||||||
} catch (e) {
|
|
||||||
if (e == MissingWalletError) {
|
|
||||||
throw new Error('TxClient:MsgFundCommunityPool:Init Could not initialize signing client. Wallet is required.')
|
|
||||||
}else{
|
|
||||||
throw new Error('TxClient:MsgFundCommunityPool:Send Could not broadcast Tx: '+ e.message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
async MsgWithdrawValidatorCommission({ rootGetters }, { value }) {
|
|
||||||
try {
|
|
||||||
const txClient=await initTxClient(rootGetters)
|
|
||||||
const msg = await txClient.msgWithdrawValidatorCommission(value)
|
|
||||||
return msg
|
|
||||||
} catch (e) {
|
|
||||||
if (e == MissingWalletError) {
|
|
||||||
throw new Error('TxClient:MsgWithdrawValidatorCommission:Init Could not initialize signing client. Wallet is required.')
|
|
||||||
}else{
|
|
||||||
throw new Error('TxClient:MsgWithdrawValidatorCommission:Create Could not create message: ' + e.message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async MsgWithdrawDelegatorReward({ rootGetters }, { value }) {
|
|
||||||
try {
|
|
||||||
const txClient=await initTxClient(rootGetters)
|
|
||||||
const msg = await txClient.msgWithdrawDelegatorReward(value)
|
|
||||||
return msg
|
|
||||||
} catch (e) {
|
|
||||||
if (e == MissingWalletError) {
|
|
||||||
throw new Error('TxClient:MsgWithdrawDelegatorReward:Init Could not initialize signing client. Wallet is required.')
|
|
||||||
}else{
|
|
||||||
throw new Error('TxClient:MsgWithdrawDelegatorReward:Create Could not create message: ' + e.message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async MsgSetWithdrawAddress({ rootGetters }, { value }) {
|
|
||||||
try {
|
|
||||||
const txClient=await initTxClient(rootGetters)
|
|
||||||
const msg = await txClient.msgSetWithdrawAddress(value)
|
|
||||||
return msg
|
|
||||||
} catch (e) {
|
|
||||||
if (e == MissingWalletError) {
|
|
||||||
throw new Error('TxClient:MsgSetWithdrawAddress:Init Could not initialize signing client. Wallet is required.')
|
|
||||||
}else{
|
|
||||||
throw new Error('TxClient:MsgSetWithdrawAddress:Create Could not create message: ' + e.message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async MsgFundCommunityPool({ rootGetters }, { value }) {
|
|
||||||
try {
|
|
||||||
const txClient=await initTxClient(rootGetters)
|
|
||||||
const msg = await txClient.msgFundCommunityPool(value)
|
|
||||||
return msg
|
|
||||||
} catch (e) {
|
|
||||||
if (e == MissingWalletError) {
|
|
||||||
throw new Error('TxClient:MsgFundCommunityPool:Init Could not initialize signing client. Wallet is required.')
|
|
||||||
}else{
|
|
||||||
throw new Error('TxClient:MsgFundCommunityPool:Create Could not create message: ' + e.message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,69 +0,0 @@
|
||||||
// THIS FILE IS GENERATED AUTOMATICALLY. DO NOT MODIFY.
|
|
||||||
|
|
||||||
import { StdFee } from "@cosmjs/launchpad";
|
|
||||||
import { SigningStargateClient } from "@cosmjs/stargate";
|
|
||||||
import { Registry, OfflineSigner, EncodeObject, DirectSecp256k1HdWallet } from "@cosmjs/proto-signing";
|
|
||||||
import { Api } from "./rest";
|
|
||||||
import { MsgWithdrawValidatorCommission } from "./types/cosmos/distribution/v1beta1/tx";
|
|
||||||
import { MsgWithdrawDelegatorReward } from "./types/cosmos/distribution/v1beta1/tx";
|
|
||||||
import { MsgSetWithdrawAddress } from "./types/cosmos/distribution/v1beta1/tx";
|
|
||||||
import { MsgFundCommunityPool } from "./types/cosmos/distribution/v1beta1/tx";
|
|
||||||
|
|
||||||
|
|
||||||
const types = [
|
|
||||||
["/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", MsgWithdrawValidatorCommission],
|
|
||||||
["/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", MsgWithdrawDelegatorReward],
|
|
||||||
["/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", MsgSetWithdrawAddress],
|
|
||||||
["/cosmos.distribution.v1beta1.MsgFundCommunityPool", MsgFundCommunityPool],
|
|
||||||
|
|
||||||
];
|
|
||||||
export const MissingWalletError = new Error("wallet is required");
|
|
||||||
|
|
||||||
export const registry = new Registry(<any>types);
|
|
||||||
|
|
||||||
const defaultFee = {
|
|
||||||
amount: [],
|
|
||||||
gas: "200000",
|
|
||||||
};
|
|
||||||
|
|
||||||
interface TxClientOptions {
|
|
||||||
addr: string
|
|
||||||
}
|
|
||||||
|
|
||||||
interface SignAndBroadcastOptions {
|
|
||||||
fee: StdFee,
|
|
||||||
memo?: string
|
|
||||||
}
|
|
||||||
|
|
||||||
const txClient = async (wallet: OfflineSigner, { addr: addr }: TxClientOptions = { addr: "http://localhost:26657" }) => {
|
|
||||||
if (!wallet) throw MissingWalletError;
|
|
||||||
let client;
|
|
||||||
if (addr) {
|
|
||||||
client = await SigningStargateClient.connectWithSigner(addr, wallet, { registry });
|
|
||||||
}else{
|
|
||||||
client = await SigningStargateClient.offline( wallet, { registry });
|
|
||||||
}
|
|
||||||
const { address } = (await wallet.getAccounts())[0];
|
|
||||||
|
|
||||||
return {
|
|
||||||
signAndBroadcast: (msgs: EncodeObject[], { fee, memo }: SignAndBroadcastOptions = {fee: defaultFee, memo: ""}) => client.signAndBroadcast(address, msgs, fee,memo),
|
|
||||||
msgWithdrawValidatorCommission: (data: MsgWithdrawValidatorCommission): EncodeObject => ({ typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", value: MsgWithdrawValidatorCommission.fromPartial( data ) }),
|
|
||||||
msgWithdrawDelegatorReward: (data: MsgWithdrawDelegatorReward): EncodeObject => ({ typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", value: MsgWithdrawDelegatorReward.fromPartial( data ) }),
|
|
||||||
msgSetWithdrawAddress: (data: MsgSetWithdrawAddress): EncodeObject => ({ typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", value: MsgSetWithdrawAddress.fromPartial( data ) }),
|
|
||||||
msgFundCommunityPool: (data: MsgFundCommunityPool): EncodeObject => ({ typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPool", value: MsgFundCommunityPool.fromPartial( data ) }),
|
|
||||||
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
interface QueryClientOptions {
|
|
||||||
addr: string
|
|
||||||
}
|
|
||||||
|
|
||||||
const queryClient = async ({ addr: addr }: QueryClientOptions = { addr: "http://localhost:1317" }) => {
|
|
||||||
return new Api({ baseUrl: addr });
|
|
||||||
};
|
|
||||||
|
|
||||||
export {
|
|
||||||
txClient,
|
|
||||||
queryClient,
|
|
||||||
};
|
|
|
@ -1,613 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
/* tslint:disable */
|
|
||||||
/*
|
|
||||||
* ---------------------------------------------------------------
|
|
||||||
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
|
|
||||||
* ## ##
|
|
||||||
* ## AUTHOR: acacode ##
|
|
||||||
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
|
|
||||||
* ---------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
export interface ProtobufAny {
|
|
||||||
"@type"?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface RpcStatus {
|
|
||||||
/** @format int32 */
|
|
||||||
code?: number;
|
|
||||||
message?: string;
|
|
||||||
details?: ProtobufAny[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Coin defines a token with a denomination and an amount.
|
|
||||||
|
|
||||||
NOTE: The amount field is an Int which implements the custom method
|
|
||||||
signatures required by gogoproto.
|
|
||||||
*/
|
|
||||||
export interface V1Beta1Coin {
|
|
||||||
denom?: string;
|
|
||||||
amount?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* DecCoin defines a token with a denomination and a decimal amount.
|
|
||||||
|
|
||||||
NOTE: The amount field is an Dec which implements the custom method
|
|
||||||
signatures required by gogoproto.
|
|
||||||
*/
|
|
||||||
export interface V1Beta1DecCoin {
|
|
||||||
denom?: string;
|
|
||||||
amount?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* DelegationDelegatorReward represents the properties
|
|
||||||
of a delegator's delegation reward.
|
|
||||||
*/
|
|
||||||
export interface V1Beta1DelegationDelegatorReward {
|
|
||||||
validator_address?: string;
|
|
||||||
reward?: V1Beta1DecCoin[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* MsgFundCommunityPoolResponse defines the Msg/FundCommunityPool response type.
|
|
||||||
*/
|
|
||||||
export type V1Beta1MsgFundCommunityPoolResponse = object;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* MsgSetWithdrawAddressResponse defines the Msg/SetWithdrawAddress response type.
|
|
||||||
*/
|
|
||||||
export type V1Beta1MsgSetWithdrawAddressResponse = object;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward response type.
|
|
||||||
*/
|
|
||||||
export type V1Beta1MsgWithdrawDelegatorRewardResponse = object;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* MsgWithdrawValidatorCommissionResponse defines the Msg/WithdrawValidatorCommission response type.
|
|
||||||
*/
|
|
||||||
export type V1Beta1MsgWithdrawValidatorCommissionResponse = object;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* message SomeRequest {
|
|
||||||
Foo some_parameter = 1;
|
|
||||||
PageRequest pagination = 2;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
export interface V1Beta1PageRequest {
|
|
||||||
/**
|
|
||||||
* key is a value returned in PageResponse.next_key to begin
|
|
||||||
* querying the next page most efficiently. Only one of offset or key
|
|
||||||
* should be set.
|
|
||||||
* @format byte
|
|
||||||
*/
|
|
||||||
key?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* offset is a numeric offset that can be used when key is unavailable.
|
|
||||||
* It is less efficient than using key. Only one of offset or key should
|
|
||||||
* be set.
|
|
||||||
* @format uint64
|
|
||||||
*/
|
|
||||||
offset?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* limit is the total number of results to be returned in the result page.
|
|
||||||
* If left empty it will default to a value to be set by each app.
|
|
||||||
* @format uint64
|
|
||||||
*/
|
|
||||||
limit?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* count_total is set to true to indicate that the result set should include
|
|
||||||
* a count of the total number of items available for pagination in UIs.
|
|
||||||
* count_total is only respected when offset is used. It is ignored when key
|
|
||||||
* is set.
|
|
||||||
*/
|
|
||||||
count_total?: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* reverse is set to true if results are to be returned in the descending order.
|
|
||||||
*
|
|
||||||
* Since: cosmos-sdk 0.43
|
|
||||||
*/
|
|
||||||
reverse?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PageResponse is to be embedded in gRPC response messages where the
|
|
||||||
corresponding request message has used PageRequest.
|
|
||||||
|
|
||||||
message SomeResponse {
|
|
||||||
repeated Bar results = 1;
|
|
||||||
PageResponse page = 2;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
export interface V1Beta1PageResponse {
|
|
||||||
/** @format byte */
|
|
||||||
next_key?: string;
|
|
||||||
|
|
||||||
/** @format uint64 */
|
|
||||||
total?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Params defines the set of params for the distribution module.
|
|
||||||
*/
|
|
||||||
export interface V1Beta1Params {
|
|
||||||
community_tax?: string;
|
|
||||||
base_proposer_reward?: string;
|
|
||||||
bonus_proposer_reward?: string;
|
|
||||||
withdraw_addr_enabled?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* QueryCommunityPoolResponse is the response type for the Query/CommunityPool
|
|
||||||
RPC method.
|
|
||||||
*/
|
|
||||||
export interface V1Beta1QueryCommunityPoolResponse {
|
|
||||||
/** pool defines community pool's coins. */
|
|
||||||
pool?: V1Beta1DecCoin[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* QueryDelegationRewardsResponse is the response type for the
|
|
||||||
Query/DelegationRewards RPC method.
|
|
||||||
*/
|
|
||||||
export interface V1Beta1QueryDelegationRewardsResponse {
|
|
||||||
/** rewards defines the rewards accrued by a delegation. */
|
|
||||||
rewards?: V1Beta1DecCoin[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* QueryDelegationTotalRewardsResponse is the response type for the
|
|
||||||
Query/DelegationTotalRewards RPC method.
|
|
||||||
*/
|
|
||||||
export interface V1Beta1QueryDelegationTotalRewardsResponse {
|
|
||||||
/** rewards defines all the rewards accrued by a delegator. */
|
|
||||||
rewards?: V1Beta1DelegationDelegatorReward[];
|
|
||||||
|
|
||||||
/** total defines the sum of all the rewards. */
|
|
||||||
total?: V1Beta1DecCoin[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* QueryDelegatorValidatorsResponse is the response type for the
|
|
||||||
Query/DelegatorValidators RPC method.
|
|
||||||
*/
|
|
||||||
export interface V1Beta1QueryDelegatorValidatorsResponse {
|
|
||||||
/** validators defines the validators a delegator is delegating for. */
|
|
||||||
validators?: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* QueryDelegatorWithdrawAddressResponse is the response type for the
|
|
||||||
Query/DelegatorWithdrawAddress RPC method.
|
|
||||||
*/
|
|
||||||
export interface V1Beta1QueryDelegatorWithdrawAddressResponse {
|
|
||||||
/** withdraw_address defines the delegator address to query for. */
|
|
||||||
withdraw_address?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* QueryParamsResponse is the response type for the Query/Params RPC method.
|
|
||||||
*/
|
|
||||||
export interface V1Beta1QueryParamsResponse {
|
|
||||||
/** params defines the parameters of the module. */
|
|
||||||
params?: V1Beta1Params;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface V1Beta1QueryValidatorCommissionResponse {
|
|
||||||
/** commission defines the commision the validator received. */
|
|
||||||
commission?: V1Beta1ValidatorAccumulatedCommission;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* QueryValidatorOutstandingRewardsResponse is the response type for the
|
|
||||||
Query/ValidatorOutstandingRewards RPC method.
|
|
||||||
*/
|
|
||||||
export interface V1Beta1QueryValidatorOutstandingRewardsResponse {
|
|
||||||
/**
|
|
||||||
* ValidatorOutstandingRewards represents outstanding (un-withdrawn) rewards
|
|
||||||
* for a validator inexpensive to track, allows simple sanity checks.
|
|
||||||
*/
|
|
||||||
rewards?: V1Beta1ValidatorOutstandingRewards;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* QueryValidatorSlashesResponse is the response type for the
|
|
||||||
Query/ValidatorSlashes RPC method.
|
|
||||||
*/
|
|
||||||
export interface V1Beta1QueryValidatorSlashesResponse {
|
|
||||||
/** slashes defines the slashes the validator received. */
|
|
||||||
slashes?: V1Beta1ValidatorSlashEvent[];
|
|
||||||
|
|
||||||
/** pagination defines the pagination in the response. */
|
|
||||||
pagination?: V1Beta1PageResponse;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ValidatorAccumulatedCommission represents accumulated commission
|
|
||||||
for a validator kept as a running counter, can be withdrawn at any time.
|
|
||||||
*/
|
|
||||||
export interface V1Beta1ValidatorAccumulatedCommission {
|
|
||||||
commission?: V1Beta1DecCoin[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ValidatorOutstandingRewards represents outstanding (un-withdrawn) rewards
|
|
||||||
for a validator inexpensive to track, allows simple sanity checks.
|
|
||||||
*/
|
|
||||||
export interface V1Beta1ValidatorOutstandingRewards {
|
|
||||||
rewards?: V1Beta1DecCoin[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ValidatorSlashEvent represents a validator slash event.
|
|
||||||
Height is implicit within the store key.
|
|
||||||
This is needed to calculate appropriate amount of staking tokens
|
|
||||||
for delegations which are withdrawn after a slash has occurred.
|
|
||||||
*/
|
|
||||||
export interface V1Beta1ValidatorSlashEvent {
|
|
||||||
/** @format uint64 */
|
|
||||||
validator_period?: string;
|
|
||||||
fraction?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type QueryParamsType = Record<string | number, any>;
|
|
||||||
export type ResponseFormat = keyof Omit<Body, "body" | "bodyUsed">;
|
|
||||||
|
|
||||||
export interface FullRequestParams extends Omit<RequestInit, "body"> {
|
|
||||||
/** set parameter to `true` for call `securityWorker` for this request */
|
|
||||||
secure?: boolean;
|
|
||||||
/** request path */
|
|
||||||
path: string;
|
|
||||||
/** content type of request body */
|
|
||||||
type?: ContentType;
|
|
||||||
/** query params */
|
|
||||||
query?: QueryParamsType;
|
|
||||||
/** format of response (i.e. response.json() -> format: "json") */
|
|
||||||
format?: keyof Omit<Body, "body" | "bodyUsed">;
|
|
||||||
/** request body */
|
|
||||||
body?: unknown;
|
|
||||||
/** base url */
|
|
||||||
baseUrl?: string;
|
|
||||||
/** request cancellation token */
|
|
||||||
cancelToken?: CancelToken;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type RequestParams = Omit<FullRequestParams, "body" | "method" | "query" | "path">;
|
|
||||||
|
|
||||||
export interface ApiConfig<SecurityDataType = unknown> {
|
|
||||||
baseUrl?: string;
|
|
||||||
baseApiParams?: Omit<RequestParams, "baseUrl" | "cancelToken" | "signal">;
|
|
||||||
securityWorker?: (securityData: SecurityDataType) => RequestParams | void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
|
|
||||||
data: D;
|
|
||||||
error: E;
|
|
||||||
}
|
|
||||||
|
|
||||||
type CancelToken = Symbol | string | number;
|
|
||||||
|
|
||||||
export enum ContentType {
|
|
||||||
Json = "application/json",
|
|
||||||
FormData = "multipart/form-data",
|
|
||||||
UrlEncoded = "application/x-www-form-urlencoded",
|
|
||||||
}
|
|
||||||
|
|
||||||
export class HttpClient<SecurityDataType = unknown> {
|
|
||||||
public baseUrl: string = "";
|
|
||||||
private securityData: SecurityDataType = null as any;
|
|
||||||
private securityWorker: null | ApiConfig<SecurityDataType>["securityWorker"] = null;
|
|
||||||
private abortControllers = new Map<CancelToken, AbortController>();
|
|
||||||
|
|
||||||
private baseApiParams: RequestParams = {
|
|
||||||
credentials: "same-origin",
|
|
||||||
headers: {},
|
|
||||||
redirect: "follow",
|
|
||||||
referrerPolicy: "no-referrer",
|
|
||||||
};
|
|
||||||
|
|
||||||
constructor(apiConfig: ApiConfig<SecurityDataType> = {}) {
|
|
||||||
Object.assign(this, apiConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
public setSecurityData = (data: SecurityDataType) => {
|
|
||||||
this.securityData = data;
|
|
||||||
};
|
|
||||||
|
|
||||||
private addQueryParam(query: QueryParamsType, key: string) {
|
|
||||||
const value = query[key];
|
|
||||||
|
|
||||||
return (
|
|
||||||
encodeURIComponent(key) +
|
|
||||||
"=" +
|
|
||||||
encodeURIComponent(Array.isArray(value) ? value.join(",") : typeof value === "number" ? value : `${value}`)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected toQueryString(rawQuery?: QueryParamsType): string {
|
|
||||||
const query = rawQuery || {};
|
|
||||||
const keys = Object.keys(query).filter((key) => "undefined" !== typeof query[key]);
|
|
||||||
return keys
|
|
||||||
.map((key) =>
|
|
||||||
typeof query[key] === "object" && !Array.isArray(query[key])
|
|
||||||
? this.toQueryString(query[key] as QueryParamsType)
|
|
||||||
: this.addQueryParam(query, key),
|
|
||||||
)
|
|
||||||
.join("&");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected addQueryParams(rawQuery?: QueryParamsType): string {
|
|
||||||
const queryString = this.toQueryString(rawQuery);
|
|
||||||
return queryString ? `?${queryString}` : "";
|
|
||||||
}
|
|
||||||
|
|
||||||
private contentFormatters: Record<ContentType, (input: any) => any> = {
|
|
||||||
[ContentType.Json]: (input: any) =>
|
|
||||||
input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input,
|
|
||||||
[ContentType.FormData]: (input: any) =>
|
|
||||||
Object.keys(input || {}).reduce((data, key) => {
|
|
||||||
data.append(key, input[key]);
|
|
||||||
return data;
|
|
||||||
}, new FormData()),
|
|
||||||
[ContentType.UrlEncoded]: (input: any) => this.toQueryString(input),
|
|
||||||
};
|
|
||||||
|
|
||||||
private mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams {
|
|
||||||
return {
|
|
||||||
...this.baseApiParams,
|
|
||||||
...params1,
|
|
||||||
...(params2 || {}),
|
|
||||||
headers: {
|
|
||||||
...(this.baseApiParams.headers || {}),
|
|
||||||
...(params1.headers || {}),
|
|
||||||
...((params2 && params2.headers) || {}),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private createAbortSignal = (cancelToken: CancelToken): AbortSignal | undefined => {
|
|
||||||
if (this.abortControllers.has(cancelToken)) {
|
|
||||||
const abortController = this.abortControllers.get(cancelToken);
|
|
||||||
if (abortController) {
|
|
||||||
return abortController.signal;
|
|
||||||
}
|
|
||||||
return void 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const abortController = new AbortController();
|
|
||||||
this.abortControllers.set(cancelToken, abortController);
|
|
||||||
return abortController.signal;
|
|
||||||
};
|
|
||||||
|
|
||||||
public abortRequest = (cancelToken: CancelToken) => {
|
|
||||||
const abortController = this.abortControllers.get(cancelToken);
|
|
||||||
|
|
||||||
if (abortController) {
|
|
||||||
abortController.abort();
|
|
||||||
this.abortControllers.delete(cancelToken);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public request = <T = any, E = any>({
|
|
||||||
body,
|
|
||||||
secure,
|
|
||||||
path,
|
|
||||||
type,
|
|
||||||
query,
|
|
||||||
format = "json",
|
|
||||||
baseUrl,
|
|
||||||
cancelToken,
|
|
||||||
...params
|
|
||||||
}: FullRequestParams): Promise<HttpResponse<T, E>> => {
|
|
||||||
const secureParams = (secure && this.securityWorker && this.securityWorker(this.securityData)) || {};
|
|
||||||
const requestParams = this.mergeRequestParams(params, secureParams);
|
|
||||||
const queryString = query && this.toQueryString(query);
|
|
||||||
const payloadFormatter = this.contentFormatters[type || ContentType.Json];
|
|
||||||
|
|
||||||
return fetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, {
|
|
||||||
...requestParams,
|
|
||||||
headers: {
|
|
||||||
...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}),
|
|
||||||
...(requestParams.headers || {}),
|
|
||||||
},
|
|
||||||
signal: cancelToken ? this.createAbortSignal(cancelToken) : void 0,
|
|
||||||
body: typeof body === "undefined" || body === null ? null : payloadFormatter(body),
|
|
||||||
}).then(async (response) => {
|
|
||||||
const r = response as HttpResponse<T, E>;
|
|
||||||
r.data = (null as unknown) as T;
|
|
||||||
r.error = (null as unknown) as E;
|
|
||||||
|
|
||||||
const data = await response[format]()
|
|
||||||
.then((data) => {
|
|
||||||
if (r.ok) {
|
|
||||||
r.data = data;
|
|
||||||
} else {
|
|
||||||
r.error = data;
|
|
||||||
}
|
|
||||||
return r;
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
r.error = e;
|
|
||||||
return r;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (cancelToken) {
|
|
||||||
this.abortControllers.delete(cancelToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!response.ok) throw data;
|
|
||||||
return data;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @title cosmos/distribution/v1beta1/distribution.proto
|
|
||||||
* @version version not set
|
|
||||||
*/
|
|
||||||
export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
|
|
||||||
/**
|
|
||||||
* No description
|
|
||||||
*
|
|
||||||
* @tags Query
|
|
||||||
* @name QueryCommunityPool
|
|
||||||
* @summary CommunityPool queries the community pool coins.
|
|
||||||
* @request GET:/cosmos/distribution/v1beta1/community_pool
|
|
||||||
*/
|
|
||||||
queryCommunityPool = (params: RequestParams = {}) =>
|
|
||||||
this.request<V1Beta1QueryCommunityPoolResponse, RpcStatus>({
|
|
||||||
path: `/cosmos/distribution/v1beta1/community_pool`,
|
|
||||||
method: "GET",
|
|
||||||
format: "json",
|
|
||||||
...params,
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* No description
|
|
||||||
*
|
|
||||||
* @tags Query
|
|
||||||
* @name QueryDelegationTotalRewards
|
|
||||||
* @summary DelegationTotalRewards queries the total rewards accrued by a each
|
|
||||||
validator.
|
|
||||||
* @request GET:/cosmos/distribution/v1beta1/delegators/{delegator_address}/rewards
|
|
||||||
*/
|
|
||||||
queryDelegationTotalRewards = (delegator_address: string, params: RequestParams = {}) =>
|
|
||||||
this.request<V1Beta1QueryDelegationTotalRewardsResponse, RpcStatus>({
|
|
||||||
path: `/cosmos/distribution/v1beta1/delegators/${delegator_address}/rewards`,
|
|
||||||
method: "GET",
|
|
||||||
format: "json",
|
|
||||||
...params,
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* No description
|
|
||||||
*
|
|
||||||
* @tags Query
|
|
||||||
* @name QueryDelegationRewards
|
|
||||||
* @summary DelegationRewards queries the total rewards accrued by a delegation.
|
|
||||||
* @request GET:/cosmos/distribution/v1beta1/delegators/{delegator_address}/rewards/{validator_address}
|
|
||||||
*/
|
|
||||||
queryDelegationRewards = (delegator_address: string, validator_address: string, params: RequestParams = {}) =>
|
|
||||||
this.request<V1Beta1QueryDelegationRewardsResponse, RpcStatus>({
|
|
||||||
path: `/cosmos/distribution/v1beta1/delegators/${delegator_address}/rewards/${validator_address}`,
|
|
||||||
method: "GET",
|
|
||||||
format: "json",
|
|
||||||
...params,
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* No description
|
|
||||||
*
|
|
||||||
* @tags Query
|
|
||||||
* @name QueryDelegatorValidators
|
|
||||||
* @summary DelegatorValidators queries the validators of a delegator.
|
|
||||||
* @request GET:/cosmos/distribution/v1beta1/delegators/{delegator_address}/validators
|
|
||||||
*/
|
|
||||||
queryDelegatorValidators = (delegator_address: string, params: RequestParams = {}) =>
|
|
||||||
this.request<V1Beta1QueryDelegatorValidatorsResponse, RpcStatus>({
|
|
||||||
path: `/cosmos/distribution/v1beta1/delegators/${delegator_address}/validators`,
|
|
||||||
method: "GET",
|
|
||||||
format: "json",
|
|
||||||
...params,
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* No description
|
|
||||||
*
|
|
||||||
* @tags Query
|
|
||||||
* @name QueryDelegatorWithdrawAddress
|
|
||||||
* @summary DelegatorWithdrawAddress queries withdraw address of a delegator.
|
|
||||||
* @request GET:/cosmos/distribution/v1beta1/delegators/{delegator_address}/withdraw_address
|
|
||||||
*/
|
|
||||||
queryDelegatorWithdrawAddress = (delegator_address: string, params: RequestParams = {}) =>
|
|
||||||
this.request<V1Beta1QueryDelegatorWithdrawAddressResponse, RpcStatus>({
|
|
||||||
path: `/cosmos/distribution/v1beta1/delegators/${delegator_address}/withdraw_address`,
|
|
||||||
method: "GET",
|
|
||||||
format: "json",
|
|
||||||
...params,
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* No description
|
|
||||||
*
|
|
||||||
* @tags Query
|
|
||||||
* @name QueryParams
|
|
||||||
* @summary Params queries params of the distribution module.
|
|
||||||
* @request GET:/cosmos/distribution/v1beta1/params
|
|
||||||
*/
|
|
||||||
queryParams = (params: RequestParams = {}) =>
|
|
||||||
this.request<V1Beta1QueryParamsResponse, RpcStatus>({
|
|
||||||
path: `/cosmos/distribution/v1beta1/params`,
|
|
||||||
method: "GET",
|
|
||||||
format: "json",
|
|
||||||
...params,
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* No description
|
|
||||||
*
|
|
||||||
* @tags Query
|
|
||||||
* @name QueryValidatorCommission
|
|
||||||
* @summary ValidatorCommission queries accumulated commission for a validator.
|
|
||||||
* @request GET:/cosmos/distribution/v1beta1/validators/{validator_address}/commission
|
|
||||||
*/
|
|
||||||
queryValidatorCommission = (validator_address: string, params: RequestParams = {}) =>
|
|
||||||
this.request<V1Beta1QueryValidatorCommissionResponse, RpcStatus>({
|
|
||||||
path: `/cosmos/distribution/v1beta1/validators/${validator_address}/commission`,
|
|
||||||
method: "GET",
|
|
||||||
format: "json",
|
|
||||||
...params,
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* No description
|
|
||||||
*
|
|
||||||
* @tags Query
|
|
||||||
* @name QueryValidatorOutstandingRewards
|
|
||||||
* @summary ValidatorOutstandingRewards queries rewards of a validator address.
|
|
||||||
* @request GET:/cosmos/distribution/v1beta1/validators/{validator_address}/outstanding_rewards
|
|
||||||
*/
|
|
||||||
queryValidatorOutstandingRewards = (validator_address: string, params: RequestParams = {}) =>
|
|
||||||
this.request<V1Beta1QueryValidatorOutstandingRewardsResponse, RpcStatus>({
|
|
||||||
path: `/cosmos/distribution/v1beta1/validators/${validator_address}/outstanding_rewards`,
|
|
||||||
method: "GET",
|
|
||||||
format: "json",
|
|
||||||
...params,
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* No description
|
|
||||||
*
|
|
||||||
* @tags Query
|
|
||||||
* @name QueryValidatorSlashes
|
|
||||||
* @summary ValidatorSlashes queries slash events of a validator.
|
|
||||||
* @request GET:/cosmos/distribution/v1beta1/validators/{validator_address}/slashes
|
|
||||||
*/
|
|
||||||
queryValidatorSlashes = (
|
|
||||||
validator_address: string,
|
|
||||||
query?: {
|
|
||||||
starting_height?: string;
|
|
||||||
ending_height?: string;
|
|
||||||
"pagination.key"?: string;
|
|
||||||
"pagination.offset"?: string;
|
|
||||||
"pagination.limit"?: string;
|
|
||||||
"pagination.count_total"?: boolean;
|
|
||||||
"pagination.reverse"?: boolean;
|
|
||||||
},
|
|
||||||
params: RequestParams = {},
|
|
||||||
) =>
|
|
||||||
this.request<V1Beta1QueryValidatorSlashesResponse, RpcStatus>({
|
|
||||||
path: `/cosmos/distribution/v1beta1/validators/${validator_address}/slashes`,
|
|
||||||
method: "GET",
|
|
||||||
query: query,
|
|
||||||
format: "json",
|
|
||||||
...params,
|
|
||||||
});
|
|
||||||
}
|
|
|
@ -1,328 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import * as Long from "long";
|
|
||||||
import { util, configure, Writer, Reader } from "protobufjs/minimal";
|
|
||||||
|
|
||||||
export const protobufPackage = "cosmos.base.query.v1beta1";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PageRequest is to be embedded in gRPC request messages for efficient
|
|
||||||
* pagination. Ex:
|
|
||||||
*
|
|
||||||
* message SomeRequest {
|
|
||||||
* Foo some_parameter = 1;
|
|
||||||
* PageRequest pagination = 2;
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
export interface PageRequest {
|
|
||||||
/**
|
|
||||||
* key is a value returned in PageResponse.next_key to begin
|
|
||||||
* querying the next page most efficiently. Only one of offset or key
|
|
||||||
* should be set.
|
|
||||||
*/
|
|
||||||
key: Uint8Array;
|
|
||||||
/**
|
|
||||||
* offset is a numeric offset that can be used when key is unavailable.
|
|
||||||
* It is less efficient than using key. Only one of offset or key should
|
|
||||||
* be set.
|
|
||||||
*/
|
|
||||||
offset: number;
|
|
||||||
/**
|
|
||||||
* limit is the total number of results to be returned in the result page.
|
|
||||||
* If left empty it will default to a value to be set by each app.
|
|
||||||
*/
|
|
||||||
limit: number;
|
|
||||||
/**
|
|
||||||
* count_total is set to true to indicate that the result set should include
|
|
||||||
* a count of the total number of items available for pagination in UIs.
|
|
||||||
* count_total is only respected when offset is used. It is ignored when key
|
|
||||||
* is set.
|
|
||||||
*/
|
|
||||||
count_total: boolean;
|
|
||||||
/**
|
|
||||||
* reverse is set to true if results are to be returned in the descending order.
|
|
||||||
*
|
|
||||||
* Since: cosmos-sdk 0.43
|
|
||||||
*/
|
|
||||||
reverse: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PageResponse is to be embedded in gRPC response messages where the
|
|
||||||
* corresponding request message has used PageRequest.
|
|
||||||
*
|
|
||||||
* message SomeResponse {
|
|
||||||
* repeated Bar results = 1;
|
|
||||||
* PageResponse page = 2;
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
export interface PageResponse {
|
|
||||||
/**
|
|
||||||
* next_key is the key to be passed to PageRequest.key to
|
|
||||||
* query the next page most efficiently
|
|
||||||
*/
|
|
||||||
next_key: Uint8Array;
|
|
||||||
/**
|
|
||||||
* total is total number of results available if PageRequest.count_total
|
|
||||||
* was set, its value is undefined otherwise
|
|
||||||
*/
|
|
||||||
total: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
const basePageRequest: object = {
|
|
||||||
offset: 0,
|
|
||||||
limit: 0,
|
|
||||||
count_total: false,
|
|
||||||
reverse: false,
|
|
||||||
};
|
|
||||||
|
|
||||||
export const PageRequest = {
|
|
||||||
encode(message: PageRequest, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.key.length !== 0) {
|
|
||||||
writer.uint32(10).bytes(message.key);
|
|
||||||
}
|
|
||||||
if (message.offset !== 0) {
|
|
||||||
writer.uint32(16).uint64(message.offset);
|
|
||||||
}
|
|
||||||
if (message.limit !== 0) {
|
|
||||||
writer.uint32(24).uint64(message.limit);
|
|
||||||
}
|
|
||||||
if (message.count_total === true) {
|
|
||||||
writer.uint32(32).bool(message.count_total);
|
|
||||||
}
|
|
||||||
if (message.reverse === true) {
|
|
||||||
writer.uint32(40).bool(message.reverse);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): PageRequest {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...basePageRequest } as PageRequest;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.key = reader.bytes();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.offset = longToNumber(reader.uint64() as Long);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
message.limit = longToNumber(reader.uint64() as Long);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
message.count_total = reader.bool();
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
message.reverse = reader.bool();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): PageRequest {
|
|
||||||
const message = { ...basePageRequest } as PageRequest;
|
|
||||||
if (object.key !== undefined && object.key !== null) {
|
|
||||||
message.key = bytesFromBase64(object.key);
|
|
||||||
}
|
|
||||||
if (object.offset !== undefined && object.offset !== null) {
|
|
||||||
message.offset = Number(object.offset);
|
|
||||||
} else {
|
|
||||||
message.offset = 0;
|
|
||||||
}
|
|
||||||
if (object.limit !== undefined && object.limit !== null) {
|
|
||||||
message.limit = Number(object.limit);
|
|
||||||
} else {
|
|
||||||
message.limit = 0;
|
|
||||||
}
|
|
||||||
if (object.count_total !== undefined && object.count_total !== null) {
|
|
||||||
message.count_total = Boolean(object.count_total);
|
|
||||||
} else {
|
|
||||||
message.count_total = false;
|
|
||||||
}
|
|
||||||
if (object.reverse !== undefined && object.reverse !== null) {
|
|
||||||
message.reverse = Boolean(object.reverse);
|
|
||||||
} else {
|
|
||||||
message.reverse = false;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: PageRequest): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.key !== undefined &&
|
|
||||||
(obj.key = base64FromBytes(
|
|
||||||
message.key !== undefined ? message.key : new Uint8Array()
|
|
||||||
));
|
|
||||||
message.offset !== undefined && (obj.offset = message.offset);
|
|
||||||
message.limit !== undefined && (obj.limit = message.limit);
|
|
||||||
message.count_total !== undefined &&
|
|
||||||
(obj.count_total = message.count_total);
|
|
||||||
message.reverse !== undefined && (obj.reverse = message.reverse);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<PageRequest>): PageRequest {
|
|
||||||
const message = { ...basePageRequest } as PageRequest;
|
|
||||||
if (object.key !== undefined && object.key !== null) {
|
|
||||||
message.key = object.key;
|
|
||||||
} else {
|
|
||||||
message.key = new Uint8Array();
|
|
||||||
}
|
|
||||||
if (object.offset !== undefined && object.offset !== null) {
|
|
||||||
message.offset = object.offset;
|
|
||||||
} else {
|
|
||||||
message.offset = 0;
|
|
||||||
}
|
|
||||||
if (object.limit !== undefined && object.limit !== null) {
|
|
||||||
message.limit = object.limit;
|
|
||||||
} else {
|
|
||||||
message.limit = 0;
|
|
||||||
}
|
|
||||||
if (object.count_total !== undefined && object.count_total !== null) {
|
|
||||||
message.count_total = object.count_total;
|
|
||||||
} else {
|
|
||||||
message.count_total = false;
|
|
||||||
}
|
|
||||||
if (object.reverse !== undefined && object.reverse !== null) {
|
|
||||||
message.reverse = object.reverse;
|
|
||||||
} else {
|
|
||||||
message.reverse = false;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const basePageResponse: object = { total: 0 };
|
|
||||||
|
|
||||||
export const PageResponse = {
|
|
||||||
encode(message: PageResponse, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.next_key.length !== 0) {
|
|
||||||
writer.uint32(10).bytes(message.next_key);
|
|
||||||
}
|
|
||||||
if (message.total !== 0) {
|
|
||||||
writer.uint32(16).uint64(message.total);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): PageResponse {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...basePageResponse } as PageResponse;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.next_key = reader.bytes();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.total = longToNumber(reader.uint64() as Long);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): PageResponse {
|
|
||||||
const message = { ...basePageResponse } as PageResponse;
|
|
||||||
if (object.next_key !== undefined && object.next_key !== null) {
|
|
||||||
message.next_key = bytesFromBase64(object.next_key);
|
|
||||||
}
|
|
||||||
if (object.total !== undefined && object.total !== null) {
|
|
||||||
message.total = Number(object.total);
|
|
||||||
} else {
|
|
||||||
message.total = 0;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: PageResponse): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.next_key !== undefined &&
|
|
||||||
(obj.next_key = base64FromBytes(
|
|
||||||
message.next_key !== undefined ? message.next_key : new Uint8Array()
|
|
||||||
));
|
|
||||||
message.total !== undefined && (obj.total = message.total);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<PageResponse>): PageResponse {
|
|
||||||
const message = { ...basePageResponse } as PageResponse;
|
|
||||||
if (object.next_key !== undefined && object.next_key !== null) {
|
|
||||||
message.next_key = object.next_key;
|
|
||||||
} else {
|
|
||||||
message.next_key = new Uint8Array();
|
|
||||||
}
|
|
||||||
if (object.total !== undefined && object.total !== null) {
|
|
||||||
message.total = object.total;
|
|
||||||
} else {
|
|
||||||
message.total = 0;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
declare var self: any | undefined;
|
|
||||||
declare var window: any | undefined;
|
|
||||||
var globalThis: any = (() => {
|
|
||||||
if (typeof globalThis !== "undefined") return globalThis;
|
|
||||||
if (typeof self !== "undefined") return self;
|
|
||||||
if (typeof window !== "undefined") return window;
|
|
||||||
if (typeof global !== "undefined") return global;
|
|
||||||
throw "Unable to locate global object";
|
|
||||||
})();
|
|
||||||
|
|
||||||
const atob: (b64: string) => string =
|
|
||||||
globalThis.atob ||
|
|
||||||
((b64) => globalThis.Buffer.from(b64, "base64").toString("binary"));
|
|
||||||
function bytesFromBase64(b64: string): Uint8Array {
|
|
||||||
const bin = atob(b64);
|
|
||||||
const arr = new Uint8Array(bin.length);
|
|
||||||
for (let i = 0; i < bin.length; ++i) {
|
|
||||||
arr[i] = bin.charCodeAt(i);
|
|
||||||
}
|
|
||||||
return arr;
|
|
||||||
}
|
|
||||||
|
|
||||||
const btoa: (bin: string) => string =
|
|
||||||
globalThis.btoa ||
|
|
||||||
((bin) => globalThis.Buffer.from(bin, "binary").toString("base64"));
|
|
||||||
function base64FromBytes(arr: Uint8Array): string {
|
|
||||||
const bin: string[] = [];
|
|
||||||
for (let i = 0; i < arr.byteLength; ++i) {
|
|
||||||
bin.push(String.fromCharCode(arr[i]));
|
|
||||||
}
|
|
||||||
return btoa(bin.join(""));
|
|
||||||
}
|
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
||||||
export type DeepPartial<T> = T extends Builtin
|
|
||||||
? T
|
|
||||||
: T extends Array<infer U>
|
|
||||||
? Array<DeepPartial<U>>
|
|
||||||
: T extends ReadonlyArray<infer U>
|
|
||||||
? ReadonlyArray<DeepPartial<U>>
|
|
||||||
: T extends {}
|
|
||||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
||||||
: Partial<T>;
|
|
||||||
|
|
||||||
function longToNumber(long: Long): number {
|
|
||||||
if (long.gt(Number.MAX_SAFE_INTEGER)) {
|
|
||||||
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
|
||||||
}
|
|
||||||
return long.toNumber();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (util.Long !== Long) {
|
|
||||||
util.Long = Long as any;
|
|
||||||
configure();
|
|
||||||
}
|
|
|
@ -1,301 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import { Writer, Reader } from "protobufjs/minimal";
|
|
||||||
|
|
||||||
export const protobufPackage = "cosmos.base.v1beta1";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Coin defines a token with a denomination and an amount.
|
|
||||||
*
|
|
||||||
* NOTE: The amount field is an Int which implements the custom method
|
|
||||||
* signatures required by gogoproto.
|
|
||||||
*/
|
|
||||||
export interface Coin {
|
|
||||||
denom: string;
|
|
||||||
amount: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* DecCoin defines a token with a denomination and a decimal amount.
|
|
||||||
*
|
|
||||||
* NOTE: The amount field is an Dec which implements the custom method
|
|
||||||
* signatures required by gogoproto.
|
|
||||||
*/
|
|
||||||
export interface DecCoin {
|
|
||||||
denom: string;
|
|
||||||
amount: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** IntProto defines a Protobuf wrapper around an Int object. */
|
|
||||||
export interface IntProto {
|
|
||||||
int: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** DecProto defines a Protobuf wrapper around a Dec object. */
|
|
||||||
export interface DecProto {
|
|
||||||
dec: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
const baseCoin: object = { denom: "", amount: "" };
|
|
||||||
|
|
||||||
export const Coin = {
|
|
||||||
encode(message: Coin, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.denom !== "") {
|
|
||||||
writer.uint32(10).string(message.denom);
|
|
||||||
}
|
|
||||||
if (message.amount !== "") {
|
|
||||||
writer.uint32(18).string(message.amount);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): Coin {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseCoin } as Coin;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.denom = reader.string();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.amount = reader.string();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): Coin {
|
|
||||||
const message = { ...baseCoin } as Coin;
|
|
||||||
if (object.denom !== undefined && object.denom !== null) {
|
|
||||||
message.denom = String(object.denom);
|
|
||||||
} else {
|
|
||||||
message.denom = "";
|
|
||||||
}
|
|
||||||
if (object.amount !== undefined && object.amount !== null) {
|
|
||||||
message.amount = String(object.amount);
|
|
||||||
} else {
|
|
||||||
message.amount = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: Coin): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.denom !== undefined && (obj.denom = message.denom);
|
|
||||||
message.amount !== undefined && (obj.amount = message.amount);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<Coin>): Coin {
|
|
||||||
const message = { ...baseCoin } as Coin;
|
|
||||||
if (object.denom !== undefined && object.denom !== null) {
|
|
||||||
message.denom = object.denom;
|
|
||||||
} else {
|
|
||||||
message.denom = "";
|
|
||||||
}
|
|
||||||
if (object.amount !== undefined && object.amount !== null) {
|
|
||||||
message.amount = object.amount;
|
|
||||||
} else {
|
|
||||||
message.amount = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseDecCoin: object = { denom: "", amount: "" };
|
|
||||||
|
|
||||||
export const DecCoin = {
|
|
||||||
encode(message: DecCoin, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.denom !== "") {
|
|
||||||
writer.uint32(10).string(message.denom);
|
|
||||||
}
|
|
||||||
if (message.amount !== "") {
|
|
||||||
writer.uint32(18).string(message.amount);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): DecCoin {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseDecCoin } as DecCoin;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.denom = reader.string();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.amount = reader.string();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): DecCoin {
|
|
||||||
const message = { ...baseDecCoin } as DecCoin;
|
|
||||||
if (object.denom !== undefined && object.denom !== null) {
|
|
||||||
message.denom = String(object.denom);
|
|
||||||
} else {
|
|
||||||
message.denom = "";
|
|
||||||
}
|
|
||||||
if (object.amount !== undefined && object.amount !== null) {
|
|
||||||
message.amount = String(object.amount);
|
|
||||||
} else {
|
|
||||||
message.amount = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: DecCoin): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.denom !== undefined && (obj.denom = message.denom);
|
|
||||||
message.amount !== undefined && (obj.amount = message.amount);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<DecCoin>): DecCoin {
|
|
||||||
const message = { ...baseDecCoin } as DecCoin;
|
|
||||||
if (object.denom !== undefined && object.denom !== null) {
|
|
||||||
message.denom = object.denom;
|
|
||||||
} else {
|
|
||||||
message.denom = "";
|
|
||||||
}
|
|
||||||
if (object.amount !== undefined && object.amount !== null) {
|
|
||||||
message.amount = object.amount;
|
|
||||||
} else {
|
|
||||||
message.amount = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseIntProto: object = { int: "" };
|
|
||||||
|
|
||||||
export const IntProto = {
|
|
||||||
encode(message: IntProto, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.int !== "") {
|
|
||||||
writer.uint32(10).string(message.int);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): IntProto {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseIntProto } as IntProto;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.int = reader.string();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): IntProto {
|
|
||||||
const message = { ...baseIntProto } as IntProto;
|
|
||||||
if (object.int !== undefined && object.int !== null) {
|
|
||||||
message.int = String(object.int);
|
|
||||||
} else {
|
|
||||||
message.int = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: IntProto): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.int !== undefined && (obj.int = message.int);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<IntProto>): IntProto {
|
|
||||||
const message = { ...baseIntProto } as IntProto;
|
|
||||||
if (object.int !== undefined && object.int !== null) {
|
|
||||||
message.int = object.int;
|
|
||||||
} else {
|
|
||||||
message.int = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseDecProto: object = { dec: "" };
|
|
||||||
|
|
||||||
export const DecProto = {
|
|
||||||
encode(message: DecProto, writer: Writer = Writer.create()): Writer {
|
|
||||||
if (message.dec !== "") {
|
|
||||||
writer.uint32(10).string(message.dec);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): DecProto {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseDecProto } as DecProto;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.dec = reader.string();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): DecProto {
|
|
||||||
const message = { ...baseDecProto } as DecProto;
|
|
||||||
if (object.dec !== undefined && object.dec !== null) {
|
|
||||||
message.dec = String(object.dec);
|
|
||||||
} else {
|
|
||||||
message.dec = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: DecProto): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.dec !== undefined && (obj.dec = message.dec);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<DecProto>): DecProto {
|
|
||||||
const message = { ...baseDecProto } as DecProto;
|
|
||||||
if (object.dec !== undefined && object.dec !== null) {
|
|
||||||
message.dec = object.dec;
|
|
||||||
} else {
|
|
||||||
message.dec = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
||||||
export type DeepPartial<T> = T extends Builtin
|
|
||||||
? T
|
|
||||||
: T extends Array<infer U>
|
|
||||||
? Array<DeepPartial<U>>
|
|
||||||
: T extends ReadonlyArray<infer U>
|
|
||||||
? ReadonlyArray<DeepPartial<U>>
|
|
||||||
: T extends {}
|
|
||||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
||||||
: Partial<T>;
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,728 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import { Reader, Writer } from "protobufjs/minimal";
|
|
||||||
import { Coin } from "../../../cosmos/base/v1beta1/coin";
|
|
||||||
|
|
||||||
export const protobufPackage = "cosmos.distribution.v1beta1";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* MsgSetWithdrawAddress sets the withdraw address for
|
|
||||||
* a delegator (or validator self-delegation).
|
|
||||||
*/
|
|
||||||
export interface MsgSetWithdrawAddress {
|
|
||||||
delegator_address: string;
|
|
||||||
withdraw_address: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** MsgSetWithdrawAddressResponse defines the Msg/SetWithdrawAddress response type. */
|
|
||||||
export interface MsgSetWithdrawAddressResponse {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* MsgWithdrawDelegatorReward represents delegation withdrawal to a delegator
|
|
||||||
* from a single validator.
|
|
||||||
*/
|
|
||||||
export interface MsgWithdrawDelegatorReward {
|
|
||||||
delegator_address: string;
|
|
||||||
validator_address: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward response type. */
|
|
||||||
export interface MsgWithdrawDelegatorRewardResponse {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* MsgWithdrawValidatorCommission withdraws the full commission to the validator
|
|
||||||
* address.
|
|
||||||
*/
|
|
||||||
export interface MsgWithdrawValidatorCommission {
|
|
||||||
validator_address: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** MsgWithdrawValidatorCommissionResponse defines the Msg/WithdrawValidatorCommission response type. */
|
|
||||||
export interface MsgWithdrawValidatorCommissionResponse {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* MsgFundCommunityPool allows an account to directly
|
|
||||||
* fund the community pool.
|
|
||||||
*/
|
|
||||||
export interface MsgFundCommunityPool {
|
|
||||||
amount: Coin[];
|
|
||||||
depositor: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** MsgFundCommunityPoolResponse defines the Msg/FundCommunityPool response type. */
|
|
||||||
export interface MsgFundCommunityPoolResponse {}
|
|
||||||
|
|
||||||
const baseMsgSetWithdrawAddress: object = {
|
|
||||||
delegator_address: "",
|
|
||||||
withdraw_address: "",
|
|
||||||
};
|
|
||||||
|
|
||||||
export const MsgSetWithdrawAddress = {
|
|
||||||
encode(
|
|
||||||
message: MsgSetWithdrawAddress,
|
|
||||||
writer: Writer = Writer.create()
|
|
||||||
): Writer {
|
|
||||||
if (message.delegator_address !== "") {
|
|
||||||
writer.uint32(10).string(message.delegator_address);
|
|
||||||
}
|
|
||||||
if (message.withdraw_address !== "") {
|
|
||||||
writer.uint32(18).string(message.withdraw_address);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): MsgSetWithdrawAddress {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseMsgSetWithdrawAddress } as MsgSetWithdrawAddress;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.delegator_address = reader.string();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.withdraw_address = reader.string();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): MsgSetWithdrawAddress {
|
|
||||||
const message = { ...baseMsgSetWithdrawAddress } as MsgSetWithdrawAddress;
|
|
||||||
if (
|
|
||||||
object.delegator_address !== undefined &&
|
|
||||||
object.delegator_address !== null
|
|
||||||
) {
|
|
||||||
message.delegator_address = String(object.delegator_address);
|
|
||||||
} else {
|
|
||||||
message.delegator_address = "";
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.withdraw_address !== undefined &&
|
|
||||||
object.withdraw_address !== null
|
|
||||||
) {
|
|
||||||
message.withdraw_address = String(object.withdraw_address);
|
|
||||||
} else {
|
|
||||||
message.withdraw_address = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: MsgSetWithdrawAddress): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.delegator_address !== undefined &&
|
|
||||||
(obj.delegator_address = message.delegator_address);
|
|
||||||
message.withdraw_address !== undefined &&
|
|
||||||
(obj.withdraw_address = message.withdraw_address);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(
|
|
||||||
object: DeepPartial<MsgSetWithdrawAddress>
|
|
||||||
): MsgSetWithdrawAddress {
|
|
||||||
const message = { ...baseMsgSetWithdrawAddress } as MsgSetWithdrawAddress;
|
|
||||||
if (
|
|
||||||
object.delegator_address !== undefined &&
|
|
||||||
object.delegator_address !== null
|
|
||||||
) {
|
|
||||||
message.delegator_address = object.delegator_address;
|
|
||||||
} else {
|
|
||||||
message.delegator_address = "";
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.withdraw_address !== undefined &&
|
|
||||||
object.withdraw_address !== null
|
|
||||||
) {
|
|
||||||
message.withdraw_address = object.withdraw_address;
|
|
||||||
} else {
|
|
||||||
message.withdraw_address = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseMsgSetWithdrawAddressResponse: object = {};
|
|
||||||
|
|
||||||
export const MsgSetWithdrawAddressResponse = {
|
|
||||||
encode(
|
|
||||||
_: MsgSetWithdrawAddressResponse,
|
|
||||||
writer: Writer = Writer.create()
|
|
||||||
): Writer {
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(
|
|
||||||
input: Reader | Uint8Array,
|
|
||||||
length?: number
|
|
||||||
): MsgSetWithdrawAddressResponse {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = {
|
|
||||||
...baseMsgSetWithdrawAddressResponse,
|
|
||||||
} as MsgSetWithdrawAddressResponse;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(_: any): MsgSetWithdrawAddressResponse {
|
|
||||||
const message = {
|
|
||||||
...baseMsgSetWithdrawAddressResponse,
|
|
||||||
} as MsgSetWithdrawAddressResponse;
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(_: MsgSetWithdrawAddressResponse): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(
|
|
||||||
_: DeepPartial<MsgSetWithdrawAddressResponse>
|
|
||||||
): MsgSetWithdrawAddressResponse {
|
|
||||||
const message = {
|
|
||||||
...baseMsgSetWithdrawAddressResponse,
|
|
||||||
} as MsgSetWithdrawAddressResponse;
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseMsgWithdrawDelegatorReward: object = {
|
|
||||||
delegator_address: "",
|
|
||||||
validator_address: "",
|
|
||||||
};
|
|
||||||
|
|
||||||
export const MsgWithdrawDelegatorReward = {
|
|
||||||
encode(
|
|
||||||
message: MsgWithdrawDelegatorReward,
|
|
||||||
writer: Writer = Writer.create()
|
|
||||||
): Writer {
|
|
||||||
if (message.delegator_address !== "") {
|
|
||||||
writer.uint32(10).string(message.delegator_address);
|
|
||||||
}
|
|
||||||
if (message.validator_address !== "") {
|
|
||||||
writer.uint32(18).string(message.validator_address);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(
|
|
||||||
input: Reader | Uint8Array,
|
|
||||||
length?: number
|
|
||||||
): MsgWithdrawDelegatorReward {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = {
|
|
||||||
...baseMsgWithdrawDelegatorReward,
|
|
||||||
} as MsgWithdrawDelegatorReward;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.delegator_address = reader.string();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.validator_address = reader.string();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): MsgWithdrawDelegatorReward {
|
|
||||||
const message = {
|
|
||||||
...baseMsgWithdrawDelegatorReward,
|
|
||||||
} as MsgWithdrawDelegatorReward;
|
|
||||||
if (
|
|
||||||
object.delegator_address !== undefined &&
|
|
||||||
object.delegator_address !== null
|
|
||||||
) {
|
|
||||||
message.delegator_address = String(object.delegator_address);
|
|
||||||
} else {
|
|
||||||
message.delegator_address = "";
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.validator_address !== undefined &&
|
|
||||||
object.validator_address !== null
|
|
||||||
) {
|
|
||||||
message.validator_address = String(object.validator_address);
|
|
||||||
} else {
|
|
||||||
message.validator_address = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: MsgWithdrawDelegatorReward): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.delegator_address !== undefined &&
|
|
||||||
(obj.delegator_address = message.delegator_address);
|
|
||||||
message.validator_address !== undefined &&
|
|
||||||
(obj.validator_address = message.validator_address);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(
|
|
||||||
object: DeepPartial<MsgWithdrawDelegatorReward>
|
|
||||||
): MsgWithdrawDelegatorReward {
|
|
||||||
const message = {
|
|
||||||
...baseMsgWithdrawDelegatorReward,
|
|
||||||
} as MsgWithdrawDelegatorReward;
|
|
||||||
if (
|
|
||||||
object.delegator_address !== undefined &&
|
|
||||||
object.delegator_address !== null
|
|
||||||
) {
|
|
||||||
message.delegator_address = object.delegator_address;
|
|
||||||
} else {
|
|
||||||
message.delegator_address = "";
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
object.validator_address !== undefined &&
|
|
||||||
object.validator_address !== null
|
|
||||||
) {
|
|
||||||
message.validator_address = object.validator_address;
|
|
||||||
} else {
|
|
||||||
message.validator_address = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseMsgWithdrawDelegatorRewardResponse: object = {};
|
|
||||||
|
|
||||||
export const MsgWithdrawDelegatorRewardResponse = {
|
|
||||||
encode(
|
|
||||||
_: MsgWithdrawDelegatorRewardResponse,
|
|
||||||
writer: Writer = Writer.create()
|
|
||||||
): Writer {
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(
|
|
||||||
input: Reader | Uint8Array,
|
|
||||||
length?: number
|
|
||||||
): MsgWithdrawDelegatorRewardResponse {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = {
|
|
||||||
...baseMsgWithdrawDelegatorRewardResponse,
|
|
||||||
} as MsgWithdrawDelegatorRewardResponse;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(_: any): MsgWithdrawDelegatorRewardResponse {
|
|
||||||
const message = {
|
|
||||||
...baseMsgWithdrawDelegatorRewardResponse,
|
|
||||||
} as MsgWithdrawDelegatorRewardResponse;
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(_: MsgWithdrawDelegatorRewardResponse): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(
|
|
||||||
_: DeepPartial<MsgWithdrawDelegatorRewardResponse>
|
|
||||||
): MsgWithdrawDelegatorRewardResponse {
|
|
||||||
const message = {
|
|
||||||
...baseMsgWithdrawDelegatorRewardResponse,
|
|
||||||
} as MsgWithdrawDelegatorRewardResponse;
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseMsgWithdrawValidatorCommission: object = { validator_address: "" };
|
|
||||||
|
|
||||||
export const MsgWithdrawValidatorCommission = {
|
|
||||||
encode(
|
|
||||||
message: MsgWithdrawValidatorCommission,
|
|
||||||
writer: Writer = Writer.create()
|
|
||||||
): Writer {
|
|
||||||
if (message.validator_address !== "") {
|
|
||||||
writer.uint32(10).string(message.validator_address);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(
|
|
||||||
input: Reader | Uint8Array,
|
|
||||||
length?: number
|
|
||||||
): MsgWithdrawValidatorCommission {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = {
|
|
||||||
...baseMsgWithdrawValidatorCommission,
|
|
||||||
} as MsgWithdrawValidatorCommission;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.validator_address = reader.string();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): MsgWithdrawValidatorCommission {
|
|
||||||
const message = {
|
|
||||||
...baseMsgWithdrawValidatorCommission,
|
|
||||||
} as MsgWithdrawValidatorCommission;
|
|
||||||
if (
|
|
||||||
object.validator_address !== undefined &&
|
|
||||||
object.validator_address !== null
|
|
||||||
) {
|
|
||||||
message.validator_address = String(object.validator_address);
|
|
||||||
} else {
|
|
||||||
message.validator_address = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: MsgWithdrawValidatorCommission): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
message.validator_address !== undefined &&
|
|
||||||
(obj.validator_address = message.validator_address);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(
|
|
||||||
object: DeepPartial<MsgWithdrawValidatorCommission>
|
|
||||||
): MsgWithdrawValidatorCommission {
|
|
||||||
const message = {
|
|
||||||
...baseMsgWithdrawValidatorCommission,
|
|
||||||
} as MsgWithdrawValidatorCommission;
|
|
||||||
if (
|
|
||||||
object.validator_address !== undefined &&
|
|
||||||
object.validator_address !== null
|
|
||||||
) {
|
|
||||||
message.validator_address = object.validator_address;
|
|
||||||
} else {
|
|
||||||
message.validator_address = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseMsgWithdrawValidatorCommissionResponse: object = {};
|
|
||||||
|
|
||||||
export const MsgWithdrawValidatorCommissionResponse = {
|
|
||||||
encode(
|
|
||||||
_: MsgWithdrawValidatorCommissionResponse,
|
|
||||||
writer: Writer = Writer.create()
|
|
||||||
): Writer {
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(
|
|
||||||
input: Reader | Uint8Array,
|
|
||||||
length?: number
|
|
||||||
): MsgWithdrawValidatorCommissionResponse {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = {
|
|
||||||
...baseMsgWithdrawValidatorCommissionResponse,
|
|
||||||
} as MsgWithdrawValidatorCommissionResponse;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(_: any): MsgWithdrawValidatorCommissionResponse {
|
|
||||||
const message = {
|
|
||||||
...baseMsgWithdrawValidatorCommissionResponse,
|
|
||||||
} as MsgWithdrawValidatorCommissionResponse;
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(_: MsgWithdrawValidatorCommissionResponse): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(
|
|
||||||
_: DeepPartial<MsgWithdrawValidatorCommissionResponse>
|
|
||||||
): MsgWithdrawValidatorCommissionResponse {
|
|
||||||
const message = {
|
|
||||||
...baseMsgWithdrawValidatorCommissionResponse,
|
|
||||||
} as MsgWithdrawValidatorCommissionResponse;
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseMsgFundCommunityPool: object = { depositor: "" };
|
|
||||||
|
|
||||||
export const MsgFundCommunityPool = {
|
|
||||||
encode(
|
|
||||||
message: MsgFundCommunityPool,
|
|
||||||
writer: Writer = Writer.create()
|
|
||||||
): Writer {
|
|
||||||
for (const v of message.amount) {
|
|
||||||
Coin.encode(v!, writer.uint32(10).fork()).ldelim();
|
|
||||||
}
|
|
||||||
if (message.depositor !== "") {
|
|
||||||
writer.uint32(18).string(message.depositor);
|
|
||||||
}
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(input: Reader | Uint8Array, length?: number): MsgFundCommunityPool {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = { ...baseMsgFundCommunityPool } as MsgFundCommunityPool;
|
|
||||||
message.amount = [];
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
case 1:
|
|
||||||
message.amount.push(Coin.decode(reader, reader.uint32()));
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.depositor = reader.string();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(object: any): MsgFundCommunityPool {
|
|
||||||
const message = { ...baseMsgFundCommunityPool } as MsgFundCommunityPool;
|
|
||||||
message.amount = [];
|
|
||||||
if (object.amount !== undefined && object.amount !== null) {
|
|
||||||
for (const e of object.amount) {
|
|
||||||
message.amount.push(Coin.fromJSON(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (object.depositor !== undefined && object.depositor !== null) {
|
|
||||||
message.depositor = String(object.depositor);
|
|
||||||
} else {
|
|
||||||
message.depositor = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(message: MsgFundCommunityPool): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
if (message.amount) {
|
|
||||||
obj.amount = message.amount.map((e) => (e ? Coin.toJSON(e) : undefined));
|
|
||||||
} else {
|
|
||||||
obj.amount = [];
|
|
||||||
}
|
|
||||||
message.depositor !== undefined && (obj.depositor = message.depositor);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(object: DeepPartial<MsgFundCommunityPool>): MsgFundCommunityPool {
|
|
||||||
const message = { ...baseMsgFundCommunityPool } as MsgFundCommunityPool;
|
|
||||||
message.amount = [];
|
|
||||||
if (object.amount !== undefined && object.amount !== null) {
|
|
||||||
for (const e of object.amount) {
|
|
||||||
message.amount.push(Coin.fromPartial(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (object.depositor !== undefined && object.depositor !== null) {
|
|
||||||
message.depositor = object.depositor;
|
|
||||||
} else {
|
|
||||||
message.depositor = "";
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseMsgFundCommunityPoolResponse: object = {};
|
|
||||||
|
|
||||||
export const MsgFundCommunityPoolResponse = {
|
|
||||||
encode(
|
|
||||||
_: MsgFundCommunityPoolResponse,
|
|
||||||
writer: Writer = Writer.create()
|
|
||||||
): Writer {
|
|
||||||
return writer;
|
|
||||||
},
|
|
||||||
|
|
||||||
decode(
|
|
||||||
input: Reader | Uint8Array,
|
|
||||||
length?: number
|
|
||||||
): MsgFundCommunityPoolResponse {
|
|
||||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
|
||||||
let end = length === undefined ? reader.len : reader.pos + length;
|
|
||||||
const message = {
|
|
||||||
...baseMsgFundCommunityPoolResponse,
|
|
||||||
} as MsgFundCommunityPoolResponse;
|
|
||||||
while (reader.pos < end) {
|
|
||||||
const tag = reader.uint32();
|
|
||||||
switch (tag >>> 3) {
|
|
||||||
default:
|
|
||||||
reader.skipType(tag & 7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromJSON(_: any): MsgFundCommunityPoolResponse {
|
|
||||||
const message = {
|
|
||||||
...baseMsgFundCommunityPoolResponse,
|
|
||||||
} as MsgFundCommunityPoolResponse;
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
|
|
||||||
toJSON(_: MsgFundCommunityPoolResponse): unknown {
|
|
||||||
const obj: any = {};
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
|
|
||||||
fromPartial(
|
|
||||||
_: DeepPartial<MsgFundCommunityPoolResponse>
|
|
||||||
): MsgFundCommunityPoolResponse {
|
|
||||||
const message = {
|
|
||||||
...baseMsgFundCommunityPoolResponse,
|
|
||||||
} as MsgFundCommunityPoolResponse;
|
|
||||||
return message;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
/** Msg defines the distribution Msg service. */
|
|
||||||
export interface Msg {
|
|
||||||
/**
|
|
||||||
* SetWithdrawAddress defines a method to change the withdraw address
|
|
||||||
* for a delegator (or validator self-delegation).
|
|
||||||
*/
|
|
||||||
SetWithdrawAddress(
|
|
||||||
request: MsgSetWithdrawAddress
|
|
||||||
): Promise<MsgSetWithdrawAddressResponse>;
|
|
||||||
/**
|
|
||||||
* WithdrawDelegatorReward defines a method to withdraw rewards of delegator
|
|
||||||
* from a single validator.
|
|
||||||
*/
|
|
||||||
WithdrawDelegatorReward(
|
|
||||||
request: MsgWithdrawDelegatorReward
|
|
||||||
): Promise<MsgWithdrawDelegatorRewardResponse>;
|
|
||||||
/**
|
|
||||||
* WithdrawValidatorCommission defines a method to withdraw the
|
|
||||||
* full commission to the validator address.
|
|
||||||
*/
|
|
||||||
WithdrawValidatorCommission(
|
|
||||||
request: MsgWithdrawValidatorCommission
|
|
||||||
): Promise<MsgWithdrawValidatorCommissionResponse>;
|
|
||||||
/**
|
|
||||||
* FundCommunityPool defines a method to allow an account to directly
|
|
||||||
* fund the community pool.
|
|
||||||
*/
|
|
||||||
FundCommunityPool(
|
|
||||||
request: MsgFundCommunityPool
|
|
||||||
): Promise<MsgFundCommunityPoolResponse>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class MsgClientImpl implements Msg {
|
|
||||||
private readonly rpc: Rpc;
|
|
||||||
constructor(rpc: Rpc) {
|
|
||||||
this.rpc = rpc;
|
|
||||||
}
|
|
||||||
SetWithdrawAddress(
|
|
||||||
request: MsgSetWithdrawAddress
|
|
||||||
): Promise<MsgSetWithdrawAddressResponse> {
|
|
||||||
const data = MsgSetWithdrawAddress.encode(request).finish();
|
|
||||||
const promise = this.rpc.request(
|
|
||||||
"cosmos.distribution.v1beta1.Msg",
|
|
||||||
"SetWithdrawAddress",
|
|
||||||
data
|
|
||||||
);
|
|
||||||
return promise.then((data) =>
|
|
||||||
MsgSetWithdrawAddressResponse.decode(new Reader(data))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
WithdrawDelegatorReward(
|
|
||||||
request: MsgWithdrawDelegatorReward
|
|
||||||
): Promise<MsgWithdrawDelegatorRewardResponse> {
|
|
||||||
const data = MsgWithdrawDelegatorReward.encode(request).finish();
|
|
||||||
const promise = this.rpc.request(
|
|
||||||
"cosmos.distribution.v1beta1.Msg",
|
|
||||||
"WithdrawDelegatorReward",
|
|
||||||
data
|
|
||||||
);
|
|
||||||
return promise.then((data) =>
|
|
||||||
MsgWithdrawDelegatorRewardResponse.decode(new Reader(data))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
WithdrawValidatorCommission(
|
|
||||||
request: MsgWithdrawValidatorCommission
|
|
||||||
): Promise<MsgWithdrawValidatorCommissionResponse> {
|
|
||||||
const data = MsgWithdrawValidatorCommission.encode(request).finish();
|
|
||||||
const promise = this.rpc.request(
|
|
||||||
"cosmos.distribution.v1beta1.Msg",
|
|
||||||
"WithdrawValidatorCommission",
|
|
||||||
data
|
|
||||||
);
|
|
||||||
return promise.then((data) =>
|
|
||||||
MsgWithdrawValidatorCommissionResponse.decode(new Reader(data))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
FundCommunityPool(
|
|
||||||
request: MsgFundCommunityPool
|
|
||||||
): Promise<MsgFundCommunityPoolResponse> {
|
|
||||||
const data = MsgFundCommunityPool.encode(request).finish();
|
|
||||||
const promise = this.rpc.request(
|
|
||||||
"cosmos.distribution.v1beta1.Msg",
|
|
||||||
"FundCommunityPool",
|
|
||||||
data
|
|
||||||
);
|
|
||||||
return promise.then((data) =>
|
|
||||||
MsgFundCommunityPoolResponse.decode(new Reader(data))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Rpc {
|
|
||||||
request(
|
|
||||||
service: string,
|
|
||||||
method: string,
|
|
||||||
data: Uint8Array
|
|
||||||
): Promise<Uint8Array>;
|
|
||||||
}
|
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
|
||||||
export type DeepPartial<T> = T extends Builtin
|
|
||||||
? T
|
|
||||||
: T extends Array<infer U>
|
|
||||||
? Array<DeepPartial<U>>
|
|
||||||
: T extends ReadonlyArray<infer U>
|
|
||||||
? ReadonlyArray<DeepPartial<U>>
|
|
||||||
: T extends {}
|
|
||||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
||||||
: Partial<T>;
|
|
|
@ -1,2 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
export const protobufPackage = "gogoproto";
|
|
|
@ -1,2 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
export const protobufPackage = "google.api";
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue