add osmosis

This commit is contained in:
Pham Tu 2024-01-19 14:56:35 +07:00
parent 023c376587
commit 544bb0b3e0
No known key found for this signature in database
GPG Key ID: 7460FD99133ADA1C
5 changed files with 102 additions and 47 deletions

View File

@ -0,0 +1,47 @@
{
"chain_name": "osmosis",
"coingecko": "osmosis",
"api": [
"https://lcd.osmosis.zone",
"https://api-osmosis-ia.cosmosia.notional.ventures",
"https://osmosis-api.polkachu.com",
"https://lcd-osmosis.blockapsis.com"
],
"rpc": [
"https://rpc.osmosis.zone",
"https://rpc-osmosis-ia.cosmosia.notional.ventures:443",
"https://osmosis-rpc.polkachu.com:443",
"https://osmosis.validator.network:443",
"https://rpc-osmosis.blockapsis.com:443"
],
"snapshot_provider": "",
"sdk_version": "0.46.1",
"coin_type": "118",
"min_tx_fee": "800",
"addr_prefix": "osmo",
"logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/osmo.png",
"theme_color": "#812cd6",
"assets": [
{
"base": "uosmo",
"symbol": "OSMO",
"exponent": "6",
"coingecko_id": "osmosis",
"logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/osmo.png"
},
{
"base": "uion",
"symbol": "ION",
"exponent": "6",
"coingecko_id": "ion",
"logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/osmo.png"
},
{
"base": "usomm",
"symbol": "SOMM",
"exponent": "6",
"coingecko_id": "somm",
"logo": ""
}
]
}

View File

@ -1,65 +1,64 @@
import { DEFAULT, fetchData } from '@/libs';
import { PageRequest } from '@/types';
import {
setupWasmExtension,
type WasmExtension,
} from '@cosmjs/cosmwasm-stargate';
import { fromBase64 } from '@cosmjs/encoding';
import type { DecodedTxRaw } from '@cosmjs/proto-signing';
import { decodeTxRaw } from '@cosmjs/proto-signing';
import {
createProtobufRpcClient,
QueryClient,
setupAuthExtension,
setupBankExtension,
setupDistributionExtension,
setupGovExtension,
setupIbcExtension,
setupMintExtension,
setupSlashingExtension,
setupStakingExtension,
setupTxExtension,
type AuthExtension,
type BankExtension,
type StakingExtension,
type TxExtension,
type MintExtension,
setupMintExtension,
type DistributionExtension,
type GovExtension,
setupGovExtension,
type GovProposalId,
type IbcExtension,
type AuthExtension,
type DistributionExtension,
setupIbcExtension,
setupSlashingExtension,
setupDistributionExtension,
createProtobufRpcClient,
setupAuthExtension,
type MintExtension,
type StakingExtension,
type TxExtension,
} from '@cosmjs/stargate';
import {
type WasmExtension,
setupWasmExtension,
} from '@cosmjs/cosmwasm-stargate';
import type { Request } from './registry';
import type { SlashingExtension } from '@cosmjs/stargate/build/modules';
import type { BondStatusString } from '@cosmjs/stargate/build/modules/staking/queries';
import { longify } from '@cosmjs/stargate/build/queryclient';
import {
HttpClient,
Tendermint37Client,
// Tendermint34Client,
WebsocketClient,
type CometClient,
type AbciQueryParams,
type CometClient,
type QueryTag,
type TxSearchParams,
type TxResponse,
} from '@cosmjs/tendermint-rpc';
import { DEFAULT, fetchData } from '@/libs';
import {
type AbstractRegistry,
findApiProfileByChain,
findApiProfileBySDKVersion,
registryChainProfile,
registryVersionProfile,
withCustomRequest,
type RequestRegistry,
} from './registry';
import { buildQuery } from '@cosmjs/tendermint-rpc/build/tendermint37/requests';
import { PageRequest } from '@/types';
import type { BondStatusString } from '@cosmjs/stargate/build/modules/staking/queries';
import type { ProposalStatus } from 'cosmjs-types/cosmos/gov/v1beta1/gov';
import { fromBase64 } from '@cosmjs/encoding';
import {
QueryAccountsResponse,
QueryClientImpl as AuthQueryClientImpl,
} from 'cosmjs-types/cosmos/auth/v1beta1/query';
import {
QueryVotesResponse,
QueryClientImpl as BankQueryClientImpl,
QueryParamsResponse as QueryBankParamsResponse,
QueryTotalSupplyResponse,
} from 'cosmjs-types/cosmos/bank/v1beta1/query';
import type { ProposalStatus } from 'cosmjs-types/cosmos/gov/v1beta1/gov';
import {
QueryClientImpl as GovQueryClientImpl,
QueryProposalsResponse,
QueryVotesResponse,
} from 'cosmjs-types/cosmos/gov/v1beta1/query';
import type { QueryValidatorDelegationsResponse } from 'cosmjs-types/cosmos/staking/v1beta1/query';
import { QueryClientImpl as StakingQueryClientImpl } from 'cosmjs-types/cosmos/staking/v1beta1/query';
import {
QueryAllContractStateResponse,
QueryClientImpl as WasmQueryClientImpl,
@ -67,17 +66,16 @@ import {
QueryContractsByCreatorResponse,
QueryParamsResponse as QueryWasmParamsResponse,
} from 'cosmjs-types/cosmwasm/wasm/v1/query';
import type { Request } from './registry';
import {
QueryClientImpl as BankQueryClientImpl,
QueryParamsResponse as QueryBankParamsResponse,
QueryTotalSupplyResponse,
} from 'cosmjs-types/cosmos/bank/v1beta1/query';
import type { SlashingExtension } from '@cosmjs/stargate/build/modules';
import type { DecodedTxRaw } from '@cosmjs/proto-signing';
import { decodeTxRaw } from '@cosmjs/proto-signing';
import { longify } from '@cosmjs/stargate/build/queryclient';
import type { QueryValidatorDelegationsResponse } from 'cosmjs-types/cosmos/staking/v1beta1/query';
import { QueryClientImpl as StakingQueryClientImpl } from 'cosmjs-types/cosmos/staking/v1beta1/query';
findApiProfileByChain,
findApiProfileBySDKVersion,
registryChainProfile,
registryVersionProfile,
withCustomRequest,
type AbstractRegistry,
type RequestRegistry,
} from './registry';
export type ExtraTxResponse = TxResponse & {
txRaw: DecodedTxRaw;

View File

@ -12,6 +12,7 @@ import type {
} from './types';
import { toAscii, toBase64 } from '@cosmjs/encoding';
import type { PageRequest } from '@/types';
import { useBlockchain } from '@/stores';
export interface WasmRequestRegistry extends AbstractRegistry {
cosmwasm_code: Request<PaginabledCodeInfos>;
@ -68,6 +69,11 @@ 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 === 'osmosis') {
page?.setCountTotal(false);
}
const res = await this.queryClient.extra.listCode(page);
return res;
}

View File

@ -150,7 +150,7 @@ export function fromLocal(lc: LocalConfig): ChainConfig {
{ denom: x.symbol.toLowerCase(), exponent: Number(x.exponent) },
],
}));
conf.cosmwasmEnabled = lc.cosmwasm_enabled ?? false;
conf.cosmwasmEnabled = lc.cosmwasm_enabled ?? true;
conf.versions = {
cosmosSdk: lc.sdk_version,
};

View File

@ -46,7 +46,7 @@ export class PageRequest {
toPagination() {
const pagination = CosmosPageRequest.fromPartial({
key: this.key ? fromBase64(this.key) : undefined,
countTotal: true,
countTotal: this.count_total ?? true,
offset: this.offset ? longify(this.offset) : undefined,
limit: this.limit ? longify(this.limit) : undefined,
reverse: this.reverse ?? true,
@ -58,6 +58,10 @@ export class PageRequest {
if (page >= 1) this.offset = (page - 1) * this.limit;
}
setCountTotal(count: boolean) {
this.count_total = count;
}
setPageSize(size: number) {
this.limit = size;
}