fix inflation osmo and cosmwasm secret
This commit is contained in:
parent
3408f0647d
commit
4dda03cd9d
@ -82,6 +82,7 @@
|
||||
"vue-tsc": "^1.8.27"
|
||||
},
|
||||
"resolutions": {
|
||||
"cosmjs-types": "^0.9.0"
|
||||
"cosmjs-types": "^0.9.0",
|
||||
"@cosmjs/math": "^0.32.2"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
import { DEFAULT, fetchData } from '@/libs';
|
||||
import { PageRequest } from '@/types';
|
||||
import {
|
||||
setupWasmExtension,
|
||||
type WasmExtension,
|
||||
} from '@cosmjs/cosmwasm-stargate';
|
||||
import { fromBase64, fromHex, toBase64, toHex } from '@cosmjs/encoding';
|
||||
fromBase64,
|
||||
fromHex,
|
||||
toBase64,
|
||||
toBech32,
|
||||
toHex,
|
||||
} from '@cosmjs/encoding';
|
||||
import type { DecodedTxRaw } from '@cosmjs/proto-signing';
|
||||
import { decodeTxRaw } from '@cosmjs/proto-signing';
|
||||
import {
|
||||
@ -15,7 +17,6 @@ import {
|
||||
setupDistributionExtension,
|
||||
setupGovExtension,
|
||||
setupIbcExtension,
|
||||
setupMintExtension,
|
||||
setupSlashingExtension,
|
||||
setupStakingExtension,
|
||||
setupTxExtension,
|
||||
@ -25,13 +26,18 @@ import {
|
||||
type GovExtension,
|
||||
type GovProposalId,
|
||||
type IbcExtension,
|
||||
type MintExtension,
|
||||
type StakingExtension,
|
||||
type TxExtension,
|
||||
} from '@cosmjs/stargate';
|
||||
import type { SlashingExtension } from '@cosmjs/stargate/build/modules';
|
||||
import type {
|
||||
MintParams,
|
||||
SlashingExtension,
|
||||
} from '@cosmjs/stargate/build/modules';
|
||||
import type { BondStatusString } from '@cosmjs/stargate/build/modules/staking/queries';
|
||||
import { longify } from '@cosmjs/stargate/build/queryclient';
|
||||
import {
|
||||
decodeCosmosSdkDecFromProto,
|
||||
longify,
|
||||
} from '@cosmjs/stargate/build/queryclient';
|
||||
import {
|
||||
HttpClient,
|
||||
Tendermint37Client,
|
||||
@ -47,6 +53,13 @@ import {
|
||||
QueryAccountsResponse,
|
||||
QueryClientImpl as AuthQueryClientImpl,
|
||||
} from 'cosmjs-types/cosmos/auth/v1beta1/query';
|
||||
import {
|
||||
QueryAnnualProvisionsResponse,
|
||||
QueryClientImpl as MintQueryClientImpl,
|
||||
QueryInflationResponse,
|
||||
QueryParamsResponse,
|
||||
} from 'cosmjs-types/cosmos/mint/v1beta1/query';
|
||||
import { QueryClientImpl as OsmoMintQueryClientImpl } from 'osmojs/dist/codegen/osmosis/mint/v1beta1/query.rpc.Query';
|
||||
import {
|
||||
QueryClientImpl as BankQueryClientImpl,
|
||||
QueryParamsResponse as QueryBankParamsResponse,
|
||||
@ -87,12 +100,17 @@ import { Tx } from 'cosmjs-types/cosmos/tx/v1beta1/tx';
|
||||
import {
|
||||
QueryAllContractStateResponse,
|
||||
QueryClientImpl as WasmQueryClientImpl,
|
||||
QueryCodeResponse,
|
||||
QueryCodesResponse,
|
||||
QueryContractHistoryResponse,
|
||||
QueryContractInfoResponse,
|
||||
QueryContractsByCodeResponse,
|
||||
QueryContractsByCreatorResponse,
|
||||
QueryParamsResponse as QueryWasmParamsResponse,
|
||||
QueryRawContractStateResponse,
|
||||
} from 'cosmjs-types/cosmwasm/wasm/v1/query';
|
||||
import { QueryClientImpl as SecretWasmQueryClientImpl } from 'secretjs/src/protobuf/secret/compute/v1beta1/query';
|
||||
|
||||
import { ChainGrpcWasmApi, type PaginationOption } from '@injectivelabs/sdk-ts';
|
||||
import { toTimestamp } from 'cosmjs-types/helpers';
|
||||
import type { Event, EventAttribute } from 'cosmjs-types/tendermint/abci/types';
|
||||
import semver from 'semver';
|
||||
@ -106,9 +124,11 @@ import {
|
||||
type AbstractRegistry,
|
||||
type RequestRegistry,
|
||||
} from './registry';
|
||||
import { decodeProto } from '@/components/dynamic';
|
||||
import { convertStr } from './utils';
|
||||
import { AccessType } from 'cosmjs-types/cosmwasm/wasm/v1/types';
|
||||
import type { JsonObject } from '@cosmjs/cosmwasm-stargate';
|
||||
import { Decimal } from '@cosmjs/math';
|
||||
import { assert } from '@cosmjs/utils';
|
||||
|
||||
export const DEFAULT_SDK_VERSION = '0.45.16';
|
||||
export const LCD_FALLBACK_CHAINS = ['OraiBtcMainnet'];
|
||||
@ -138,6 +158,44 @@ export interface ExtraQueryProposalsResponse {
|
||||
}
|
||||
|
||||
export interface ExtraExtension {
|
||||
readonly mint: {
|
||||
readonly params: () => Promise<JsonObject>;
|
||||
readonly inflation: () => Promise<Decimal>;
|
||||
readonly annualProvisions: () => Promise<Decimal>;
|
||||
};
|
||||
readonly wasm: {
|
||||
readonly contractsByCreator: (
|
||||
address: string,
|
||||
page?: PageRequest
|
||||
) => Promise<QueryContractsByCreatorResponse>;
|
||||
readonly contractStates: (
|
||||
address: string,
|
||||
page?: PageRequest
|
||||
) => Promise<QueryAllContractStateResponse>;
|
||||
readonly wasmParams: () => Promise<QueryWasmParamsResponse>;
|
||||
readonly listCode: (page?: PageRequest) => Promise<QueryCodesResponse>;
|
||||
readonly listContractsByCodeId: (
|
||||
codeId: string,
|
||||
page?: PageRequest,
|
||||
secret?: boolean
|
||||
) => Promise<QueryContractsByCodeResponse>;
|
||||
readonly getCode: (id: string) => Promise<QueryCodeResponse>;
|
||||
readonly getContractInfo: (
|
||||
address: string
|
||||
) => Promise<QueryContractInfoResponse>;
|
||||
readonly getContractCodeHistory: (
|
||||
address: string,
|
||||
page?: PageRequest
|
||||
) => Promise<QueryContractHistoryResponse>;
|
||||
readonly queryContractRaw: (
|
||||
address: string,
|
||||
key: Uint8Array
|
||||
) => Promise<QueryRawContractStateResponse>;
|
||||
readonly queryContractSmart: (
|
||||
address: string,
|
||||
query: JsonObject
|
||||
) => Promise<JsonObject>;
|
||||
};
|
||||
readonly extra: {
|
||||
readonly accounts: (page?: PageRequest) => Promise<QueryAccountsResponse>;
|
||||
readonly votes: (
|
||||
@ -155,20 +213,8 @@ export interface ExtraExtension {
|
||||
readonly totalSupply: (
|
||||
page?: PageRequest
|
||||
) => Promise<QueryTotalSupplyResponse>;
|
||||
readonly listCode: (
|
||||
page?: PageRequest,
|
||||
secret?: boolean
|
||||
) => Promise<QueryCodesResponse>;
|
||||
readonly wasmParams: () => Promise<QueryWasmParamsResponse>;
|
||||
|
||||
readonly bankParams: () => Promise<QueryBankParamsResponse>;
|
||||
readonly contractsByCreator: (
|
||||
address: string,
|
||||
page?: PageRequest
|
||||
) => Promise<QueryContractsByCreatorResponse>;
|
||||
readonly contractStates: (
|
||||
address: string,
|
||||
page?: PageRequest
|
||||
) => Promise<QueryAllContractStateResponse>;
|
||||
|
||||
readonly validatorDelegations: (
|
||||
validatorAddr: string,
|
||||
@ -178,6 +224,7 @@ export interface ExtraExtension {
|
||||
readonly getNodeInfo: () => Promise<GetNodeInfoResponse>;
|
||||
};
|
||||
}
|
||||
|
||||
function setupExtraExtension(base: QueryClient) {
|
||||
const rpc = createProtobufRpcClient(base);
|
||||
const authQueryService = new AuthQueryClientImpl(rpc);
|
||||
@ -185,10 +232,297 @@ function setupExtraExtension(base: QueryClient) {
|
||||
const govQueryServiceV1 = new GovQueryClientImplV1(rpc);
|
||||
const bankQueryService = new BankQueryClientImpl(rpc);
|
||||
const wasmQueryService = new WasmQueryClientImpl(rpc);
|
||||
const secretWasmQueryClientImpl = new SecretWasmQueryClientImpl(rpc);
|
||||
const secretWasmQueryService = new SecretWasmQueryClientImpl(rpc);
|
||||
const stakingQueryService = new StakingQueryClientImpl(rpc);
|
||||
const tmQueryClientImpl = new TmQueryClientImpl(rpc);
|
||||
const mintQueryService = new MintQueryClientImpl(rpc);
|
||||
const osmoMintQueryService = new OsmoMintQueryClientImpl(rpc);
|
||||
const tmQueryService = new TmQueryClientImpl(rpc);
|
||||
const blockchain = useBlockchain();
|
||||
return {
|
||||
mint: {
|
||||
params: async (): Promise<JsonObject> => {
|
||||
switch (blockchain.chainName) {
|
||||
case 'osmosis':
|
||||
const osmoRes = await osmoMintQueryService.params();
|
||||
return osmoRes.params;
|
||||
default:
|
||||
const res = await mintQueryService.Params();
|
||||
return res.params;
|
||||
}
|
||||
},
|
||||
inflation: async (): Promise<Decimal> => {
|
||||
switch (blockchain.chainName) {
|
||||
case 'osmosis':
|
||||
const res = await osmoMintQueryService.params();
|
||||
return Decimal.fromAtomics(
|
||||
(
|
||||
(1 -
|
||||
Number(res.params.distributionProportions.developerRewards)) *
|
||||
1e6
|
||||
).toString(),
|
||||
6
|
||||
);
|
||||
default:
|
||||
const { inflation } = await mintQueryService.Inflation();
|
||||
return decodeCosmosSdkDecFromProto(inflation);
|
||||
}
|
||||
},
|
||||
annualProvisions: async (): Promise<Decimal> => {
|
||||
const { annualProvisions } = await mintQueryService.AnnualProvisions();
|
||||
return decodeCosmosSdkDecFromProto(annualProvisions);
|
||||
},
|
||||
},
|
||||
wasm: {
|
||||
listCode: async (page?: PageRequest): Promise<QueryCodesResponse> => {
|
||||
switch (blockchain.chainName) {
|
||||
case 'injective': {
|
||||
let endpoint = blockchain.current?.endpoints.grpc?.[0].address!;
|
||||
const wasmApi = new ChainGrpcWasmApi(endpoint);
|
||||
const paginationOption = {
|
||||
reverse: page?.reverse ?? true,
|
||||
key: page?.key,
|
||||
countTotal: false,
|
||||
limit: page?.limit,
|
||||
};
|
||||
|
||||
const { codeInfosList, pagination } =
|
||||
await wasmApi.fetchContractCodes(paginationOption);
|
||||
|
||||
return {
|
||||
codeInfos: codeInfosList.map((info) => {
|
||||
return {
|
||||
codeId: BigInt(info.codeId),
|
||||
creator: info.creator,
|
||||
dataHash:
|
||||
typeof info.dataHash === 'string'
|
||||
? fromBase64(info.dataHash)
|
||||
: info.dataHash,
|
||||
instantiatePermission: {
|
||||
permission: AccessType.ACCESS_TYPE_EVERYBODY,
|
||||
addresses: [] as string[],
|
||||
address: '',
|
||||
},
|
||||
};
|
||||
}),
|
||||
pagination: {
|
||||
nextKey: pagination.next
|
||||
? fromBase64(pagination.next)
|
||||
: new Uint8Array(),
|
||||
total: BigInt(pagination.total),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
case 'secret': {
|
||||
const res = await secretWasmQueryService.Codes({
|
||||
pagination: page?.toPagination(),
|
||||
});
|
||||
|
||||
return {
|
||||
codeInfos: res.code_infos.map((codeInfo) => {
|
||||
return {
|
||||
codeId: BigInt(codeInfo.code_id),
|
||||
creator: codeInfo.creator,
|
||||
dataHash: fromHex(codeInfo.code_hash),
|
||||
instantiatePermission: {
|
||||
permission: AccessType.ACCESS_TYPE_EVERYBODY,
|
||||
address: '',
|
||||
addresses: [],
|
||||
},
|
||||
};
|
||||
}),
|
||||
};
|
||||
}
|
||||
default:
|
||||
return await wasmQueryService.Codes({
|
||||
pagination: page?.toPagination(),
|
||||
});
|
||||
}
|
||||
},
|
||||
listContractsByCodeId: async (
|
||||
codeId: string,
|
||||
page?: PageRequest
|
||||
): Promise<QueryContractsByCodeResponse> => {
|
||||
switch (blockchain.chainName) {
|
||||
case 'secret': {
|
||||
const res = await secretWasmQueryService.ContractsByCodeId({
|
||||
code_id: codeId,
|
||||
});
|
||||
return {
|
||||
contracts: res.contract_infos.map((c) => c.contract_address),
|
||||
};
|
||||
}
|
||||
default:
|
||||
return await wasmQueryService.ContractsByCode({
|
||||
codeId: BigInt(codeId),
|
||||
pagination: page?.toPagination(),
|
||||
});
|
||||
}
|
||||
},
|
||||
wasmParams: async () => {
|
||||
return await wasmQueryService.Params();
|
||||
},
|
||||
contractsByCreator: async (
|
||||
address: string,
|
||||
page?: PageRequest
|
||||
): Promise<QueryContractsByCreatorResponse> => {
|
||||
switch (blockchain.chainName) {
|
||||
case 'secret': {
|
||||
return {
|
||||
contractAddresses: [],
|
||||
};
|
||||
}
|
||||
default:
|
||||
return await wasmQueryService.ContractsByCreator({
|
||||
pagination: page?.toPagination(),
|
||||
creatorAddress: address,
|
||||
});
|
||||
}
|
||||
},
|
||||
contractStates: async (
|
||||
address: string,
|
||||
page?: PageRequest
|
||||
): Promise<QueryAllContractStateResponse> => {
|
||||
switch (blockchain.chainName) {
|
||||
case 'secret': {
|
||||
return {
|
||||
models: [],
|
||||
};
|
||||
}
|
||||
default:
|
||||
return await wasmQueryService.AllContractState({
|
||||
pagination: page?.toPagination(),
|
||||
address,
|
||||
});
|
||||
}
|
||||
},
|
||||
getCode: async (codeId: string): Promise<QueryCodeResponse> => {
|
||||
switch (blockchain.chainName) {
|
||||
case 'secret': {
|
||||
const res = await secretWasmQueryService.Code({
|
||||
code_id: codeId,
|
||||
});
|
||||
const codeInfo = res.code_info!;
|
||||
return {
|
||||
codeInfo: {
|
||||
codeId: BigInt(codeInfo.code_id),
|
||||
creator: codeInfo.creator,
|
||||
dataHash: fromHex(codeInfo.code_hash),
|
||||
instantiatePermission: {
|
||||
permission: AccessType.ACCESS_TYPE_EVERYBODY,
|
||||
address: '',
|
||||
addresses: [],
|
||||
},
|
||||
},
|
||||
data: res.wasm,
|
||||
};
|
||||
}
|
||||
default:
|
||||
return await wasmQueryService.Code({
|
||||
codeId: BigInt(codeId),
|
||||
});
|
||||
}
|
||||
},
|
||||
getContractInfo: async (
|
||||
address: string
|
||||
): Promise<QueryContractInfoResponse> => {
|
||||
switch (blockchain.chainName) {
|
||||
case 'secret': {
|
||||
const res = await secretWasmQueryService.ContractInfo({
|
||||
contract_address: address,
|
||||
});
|
||||
const contractInfo = res.contract_info!;
|
||||
return {
|
||||
address: res.contract_address,
|
||||
contractInfo: {
|
||||
codeId: BigInt(contractInfo.code_id),
|
||||
creator: toBech32('secret', contractInfo.creator),
|
||||
admin: contractInfo.admin,
|
||||
label: contractInfo.label,
|
||||
created: contractInfo.created
|
||||
? {
|
||||
blockHeight: BigInt(contractInfo.created.block_height),
|
||||
txIndex: BigInt(contractInfo.created.tx_index),
|
||||
}
|
||||
: undefined,
|
||||
ibcPortId: contractInfo.ibc_port_id,
|
||||
},
|
||||
};
|
||||
}
|
||||
default:
|
||||
return await wasmQueryService.ContractInfo({
|
||||
address,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
getContractCodeHistory: async (
|
||||
address: string,
|
||||
page?: PageRequest
|
||||
): Promise<QueryContractHistoryResponse> => {
|
||||
switch (blockchain.chainName) {
|
||||
case 'secret':
|
||||
const res = await secretWasmQueryService.ContractHistory({
|
||||
contract_address: address,
|
||||
});
|
||||
return {
|
||||
entries: res.entries.map((entry) => {
|
||||
return {
|
||||
operation: entry.operation,
|
||||
codeId: BigInt(entry.code_id),
|
||||
updated: entry.updated
|
||||
? {
|
||||
blockHeight: BigInt(entry.updated.block_height),
|
||||
txIndex: BigInt(entry.updated.tx_index),
|
||||
}
|
||||
: undefined,
|
||||
msg: entry.msg,
|
||||
};
|
||||
}),
|
||||
};
|
||||
default:
|
||||
return await wasmQueryService.ContractHistory({
|
||||
address,
|
||||
pagination: page?.toPagination(),
|
||||
});
|
||||
}
|
||||
},
|
||||
queryContractRaw: async (
|
||||
address: string,
|
||||
key: Uint8Array
|
||||
): Promise<QueryRawContractStateResponse> => {
|
||||
switch (blockchain.chainName) {
|
||||
case 'secret':
|
||||
const res = await secretWasmQueryService.QuerySecretContract({
|
||||
contract_address: address,
|
||||
query: key,
|
||||
});
|
||||
return {
|
||||
data: res.data,
|
||||
};
|
||||
default:
|
||||
return await wasmQueryService.RawContractState({
|
||||
address,
|
||||
queryData: key,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
queryContractSmart: async (
|
||||
address: string,
|
||||
query: JsonObject
|
||||
): Promise<JsonObject> => {
|
||||
switch (blockchain.chainName) {
|
||||
case 'secret':
|
||||
return {};
|
||||
default:
|
||||
return await wasmQueryService.SmartContractState({
|
||||
address,
|
||||
queryData: query,
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
extra: {
|
||||
accounts: async (page?: PageRequest) => {
|
||||
return authQueryService.Accounts({
|
||||
@ -225,49 +559,7 @@ function setupExtraExtension(base: QueryClient) {
|
||||
pagination: page?.toPagination(),
|
||||
});
|
||||
},
|
||||
listCode: async (
|
||||
page?: PageRequest,
|
||||
secret = false
|
||||
): Promise<QueryCodesResponse> => {
|
||||
if (secret) {
|
||||
const res = await secretWasmQueryClientImpl.Codes({
|
||||
pagination: page?.toPagination(),
|
||||
});
|
||||
|
||||
return {
|
||||
codeInfos: res.code_infos.map((codeInfo) => {
|
||||
return {
|
||||
codeId: BigInt(codeInfo.code_id),
|
||||
creator: codeInfo.creator,
|
||||
dataHash: fromHex(codeInfo.code_hash),
|
||||
instantiatePermission: {
|
||||
permission: AccessType.ACCESS_TYPE_EVERYBODY,
|
||||
address: '',
|
||||
addresses: [],
|
||||
},
|
||||
};
|
||||
}),
|
||||
};
|
||||
}
|
||||
return await wasmQueryService.Codes({
|
||||
pagination: page?.toPagination(),
|
||||
});
|
||||
},
|
||||
wasmParams: async () => {
|
||||
return await wasmQueryService.Params();
|
||||
},
|
||||
contractsByCreator: async (address: string, page?: PageRequest) => {
|
||||
return await wasmQueryService.ContractsByCreator({
|
||||
pagination: page?.toPagination(),
|
||||
creatorAddress: address,
|
||||
});
|
||||
},
|
||||
contractStates: async (address: string, page?: PageRequest) => {
|
||||
return await wasmQueryService.AllContractState({
|
||||
pagination: page?.toPagination(),
|
||||
address,
|
||||
});
|
||||
},
|
||||
bankParams: async () => {
|
||||
return await bankQueryService.Params();
|
||||
},
|
||||
@ -282,7 +574,7 @@ function setupExtraExtension(base: QueryClient) {
|
||||
},
|
||||
|
||||
getNodeInfo: async () => {
|
||||
return await tmQueryClientImpl.GetNodeInfo();
|
||||
return await tmQueryService.GetNodeInfo();
|
||||
},
|
||||
},
|
||||
};
|
||||
@ -298,13 +590,11 @@ export class BaseRestClient<R extends AbstractRegistry> {
|
||||
AuthExtension &
|
||||
BankExtension &
|
||||
StakingExtension &
|
||||
MintExtension &
|
||||
GovExtension &
|
||||
IbcExtension &
|
||||
SlashingExtension &
|
||||
DistributionExtension &
|
||||
TxExtension &
|
||||
WasmExtension &
|
||||
ExtraExtension;
|
||||
|
||||
constructor(endpoint: string, registry: R, version?: string) {
|
||||
@ -326,13 +616,11 @@ export class BaseRestClient<R extends AbstractRegistry> {
|
||||
setupAuthExtension,
|
||||
setupBankExtension,
|
||||
setupStakingExtension,
|
||||
setupMintExtension,
|
||||
setupGovExtension,
|
||||
setupIbcExtension,
|
||||
setupSlashingExtension,
|
||||
setupDistributionExtension,
|
||||
setupTxExtension,
|
||||
setupWasmExtension,
|
||||
setupExtraExtension
|
||||
);
|
||||
}
|
||||
@ -1084,7 +1372,7 @@ export class CosmosRestClient extends BaseRestClient<RequestRegistry> {
|
||||
// return this.request(this.registry.mint_inflation, {});
|
||||
try {
|
||||
const res = await this.queryClient.mint.inflation();
|
||||
|
||||
// const res = await this.queryClient.mint.inflation();
|
||||
return res;
|
||||
} catch (ex) {
|
||||
console.log(ex);
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
import { ChainGrpcWasmApi, type PaginationOption } from '@injectivelabs/sdk-ts';
|
||||
import { BaseRestClient } from '@/libs/client';
|
||||
import { adapter, type AbstractRegistry, type Request } from '@/libs/registry';
|
||||
|
||||
@ -78,74 +77,32 @@ export class WasmRestClient extends BaseRestClient<WasmRequestRegistry> {
|
||||
// if(!pr) pr = new PageRequest()
|
||||
// const query = `?${pr.toQueryString()}`
|
||||
// return this.request(this.registry.cosmwasm_code, {}, /*query*/);
|
||||
const blockchain = useBlockchain();
|
||||
|
||||
if (blockchain.chainName === 'injective') {
|
||||
let endpoint = blockchain.current?.endpoints.grpc?.[0].address;
|
||||
if (!endpoint) return;
|
||||
const wasmApi = new ChainGrpcWasmApi(endpoint);
|
||||
const paginationOption = {
|
||||
reverse: page?.reverse ?? true,
|
||||
key: page?.key,
|
||||
countTotal: false,
|
||||
limit: page?.limit,
|
||||
};
|
||||
|
||||
const { codeInfosList, pagination } = await wasmApi.fetchContractCodes(
|
||||
paginationOption
|
||||
);
|
||||
|
||||
return {
|
||||
codeInfos: codeInfosList.map((info) => {
|
||||
return {
|
||||
codeId: BigInt(info.codeId),
|
||||
creator: info.creator,
|
||||
dataHash:
|
||||
typeof info.dataHash === 'string'
|
||||
? fromBase64(info.dataHash)
|
||||
: info.dataHash,
|
||||
instantiatePermission: {
|
||||
permission: AccessType.ACCESS_TYPE_EVERYBODY,
|
||||
addresses: [] as string[],
|
||||
address: '',
|
||||
},
|
||||
};
|
||||
}),
|
||||
pagination: {
|
||||
nextKey: pagination.next
|
||||
? fromBase64(pagination.next)
|
||||
: new Uint8Array(),
|
||||
total: BigInt(pagination.total),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
page?.setCountTotal(false);
|
||||
|
||||
const res = await this.queryClient.extra.listCode(
|
||||
page,
|
||||
blockchain.chainName === 'secret'
|
||||
);
|
||||
const res = await this.queryClient.wasm.listCode(page);
|
||||
|
||||
return res;
|
||||
}
|
||||
async getWasmCodeById(code_id: string) {
|
||||
async getWasmCodeById(codeId: string) {
|
||||
// return this.request(this.registry.cosmwasm_code, { code_id }); // `code_id` is a param in above url
|
||||
const res = await this.queryClient.wasm.getCode(Number(code_id));
|
||||
const res = await this.queryClient.wasm.getCode(codeId);
|
||||
return res;
|
||||
}
|
||||
async getWasmCodeContracts(code_id: string, page?: PageRequest) {
|
||||
// if(!page) page = new PageRequest()
|
||||
// const query = `?${page.toQueryString()}`
|
||||
// return this.request(this.registry.cosmwasm_code_id_contracts, { code_id });
|
||||
page?.setCountTotal(false);
|
||||
const res = await this.queryClient.wasm.listContractsByCodeId(
|
||||
Number(code_id)
|
||||
code_id,
|
||||
page
|
||||
);
|
||||
return res;
|
||||
}
|
||||
async getWasmParams() {
|
||||
// return this.request(this.registry.cosmwasm_param, {});
|
||||
const res = await this.queryClient.extra.wasmParams();
|
||||
const res = await this.queryClient.wasm.wasmParams();
|
||||
return res;
|
||||
}
|
||||
async getWasmContractInfo(address: string) {
|
||||
@ -161,7 +118,7 @@ export class WasmRestClient extends BaseRestClient<WasmRequestRegistry> {
|
||||
// if(!page) page = new PageRequest()
|
||||
// const query = `?${page.toQueryString()}`
|
||||
// return this.request(this.registry.cosmwasm_wasm_contracts_creator, { creator_address });
|
||||
const res = await this.queryClient.extra.contractsByCreator(
|
||||
const res = await this.queryClient.wasm.contractsByCreator(
|
||||
creator_address,
|
||||
page
|
||||
);
|
||||
@ -203,15 +160,10 @@ export class WasmRestClient extends BaseRestClient<WasmRequestRegistry> {
|
||||
address: string,
|
||||
page: PageRequest
|
||||
): Promise<QueryAllContractStateResponse | undefined> {
|
||||
// const blockchain = useBlockchain();
|
||||
try {
|
||||
// if (
|
||||
// blockchain.chainName === 'osmosis' ||
|
||||
// blockchain.chainName === 'injective'
|
||||
// ) {
|
||||
page.setCountTotal(false);
|
||||
// }
|
||||
const res = await this.queryClient.extra.contractStates(address, page);
|
||||
|
||||
const res = await this.queryClient.wasm.contractStates(address, page);
|
||||
return res;
|
||||
} catch (ex) {
|
||||
console.log(ex);
|
||||
|
||||
@ -159,7 +159,7 @@ export const useParamStore = defineStore('paramstore', {
|
||||
// const chainIndex = this.chain.items.findIndex(x => x.subtitle === 'inflation')
|
||||
// this.chain.items[chainIndex].value = `${percent(res)}%`
|
||||
// })
|
||||
const res = await this.getMintParam();
|
||||
// const res = await this.getMintParam();
|
||||
},
|
||||
async handleSlashingParams() {
|
||||
const res = await this.getSlashingParams();
|
||||
|
||||
37
yarn.lock
37
yarn.lock
@ -1507,42 +1507,7 @@
|
||||
ledger-cosmos-js "^2.1.8"
|
||||
semver "^7.5.2"
|
||||
|
||||
"@cosmjs/math@0.27.1":
|
||||
version "0.27.1"
|
||||
resolved "https://registry.yarnpkg.com/@cosmjs/math/-/math-0.27.1.tgz#be78857b008ffc6b1ed6fecaa1c4cd5bc38c07d7"
|
||||
integrity sha512-cHWVjmfIjtRc7f80n7x+J5k8pe+vTVTQ0lA82tIxUgqUvgS6rogPP/TmGtTiZ4+NxWxd11DUISY6gVpr18/VNQ==
|
||||
dependencies:
|
||||
bn.js "^5.2.0"
|
||||
|
||||
"@cosmjs/math@^0.29.3", "@cosmjs/math@^0.29.5":
|
||||
version "0.29.5"
|
||||
resolved "https://registry.yarnpkg.com/@cosmjs/math/-/math-0.29.5.tgz#722c96e080d6c2b62215ce9f4c70da7625b241b6"
|
||||
integrity sha512-2GjKcv+A9f86MAWYLUkjhw1/WpRl2R1BTb3m9qPG7lzMA7ioYff9jY5SPCfafKdxM4TIQGxXQlYGewQL16O68Q==
|
||||
dependencies:
|
||||
bn.js "^5.2.0"
|
||||
|
||||
"@cosmjs/math@^0.30.0", "@cosmjs/math@^0.30.1":
|
||||
version "0.30.1"
|
||||
resolved "https://registry.yarnpkg.com/@cosmjs/math/-/math-0.30.1.tgz#8b816ef4de5d3afa66cb9fdfb5df2357a7845b8a"
|
||||
integrity sha512-yaoeI23pin9ZiPHIisa6qqLngfnBR/25tSaWpkTm8Cy10MX70UF5oN4+/t1heLaM6SSmRrhk3psRkV4+7mH51Q==
|
||||
dependencies:
|
||||
bn.js "^5.2.0"
|
||||
|
||||
"@cosmjs/math@^0.31.1":
|
||||
version "0.31.1"
|
||||
resolved "https://registry.yarnpkg.com/@cosmjs/math/-/math-0.31.1.tgz#74c02cf237c2996b77661b636b014168b18d95e6"
|
||||
integrity sha512-kiuHV6m6DSB8/4UV1qpFhlc4ul8SgLXTGRlYkYiIIP4l0YNeJ+OpPYaOlEgx4Unk2mW3/O2FWYj7Jc93+BWXng==
|
||||
dependencies:
|
||||
bn.js "^5.2.0"
|
||||
|
||||
"@cosmjs/math@^0.31.3":
|
||||
version "0.31.3"
|
||||
resolved "https://registry.yarnpkg.com/@cosmjs/math/-/math-0.31.3.tgz#767f7263d12ba1b9ed2f01f68d857597839fd957"
|
||||
integrity sha512-kZ2C6glA5HDb9hLz1WrftAjqdTBb3fWQsRR+Us2HsjAYdeE6M3VdXMsYCP5M3yiihal1WDwAY2U7HmfJw7Uh4A==
|
||||
dependencies:
|
||||
bn.js "^5.2.0"
|
||||
|
||||
"@cosmjs/math@^0.32.2":
|
||||
"@cosmjs/math@0.27.1", "@cosmjs/math@^0.29.3", "@cosmjs/math@^0.29.5", "@cosmjs/math@^0.30.0", "@cosmjs/math@^0.30.1", "@cosmjs/math@^0.31.1", "@cosmjs/math@^0.31.3", "@cosmjs/math@^0.32.2":
|
||||
version "0.32.2"
|
||||
resolved "https://registry.yarnpkg.com/@cosmjs/math/-/math-0.32.2.tgz#4522312769197e132679e4960862bcec0eed4cb8"
|
||||
integrity sha512-b8+ruAAY8aKtVKWSft2IvtCVCUH1LigIlf9ALIiY8n9jtM4kMASiaRbQ/27etnSAInV88IaezKK9rQZrtxTjcw==
|
||||
|
||||
Loading…
Reference in New Issue
Block a user