Skip to content

Commit

Permalink
Merge pull request #95 from hyperweb-io/enhance-decimal
Browse files Browse the repository at this point in the history
upgrade telescope and regen, fix decimal
  • Loading branch information
Zetazzz authored Mar 3, 2025
2 parents 8ec61a6 + ed8868b commit bd51489
Show file tree
Hide file tree
Showing 150 changed files with 1,138 additions and 1,915 deletions.
2 changes: 1 addition & 1 deletion libs/cosmos-types/src/binary.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* This file and any referenced files were automatically generated by @cosmology/[email protected].20
* This file and any referenced files were automatically generated by @cosmology/[email protected].22
* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain
* and run the transpile command or npm scripts command that is used to regenerate this bundle.
*/
Expand Down
2 changes: 1 addition & 1 deletion libs/cosmos-types/src/cosmos/base/v1beta1/coin.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BinaryReader, BinaryWriter } from "../../../binary";
import { DeepPartial } from "../../../helpers";
import { Decimal } from "../../../decimals";
import { Decimal } from "@interchainjs/math";
/**
* Coin defines a token with a denomination and an amount.
*
Expand Down
2 changes: 1 addition & 1 deletion libs/cosmos-types/src/cosmos/gov/v1beta1/gov.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Any } from "../../../google/protobuf/any";
import { Timestamp } from "../../../google/protobuf/timestamp";
import { Duration } from "../../../google/protobuf/duration";
import { BinaryReader, BinaryWriter } from "../../../binary";
import { Decimal } from "../../../decimals";
import { Decimal } from "@interchainjs/math";
import { DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers";
/** VoteOption enumerates the valid vote options for a given governance proposal. */
export enum VoteOption {
Expand Down
2 changes: 1 addition & 1 deletion libs/cosmos-types/src/cosmos/staking/v1beta1/staking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Coin } from "../../base/v1beta1/coin";
import { ValidatorUpdate } from "../../../tendermint/abci/types";
import { BinaryReader, BinaryWriter } from "../../../binary";
import { DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers";
import { Decimal } from "../../../decimals";
import { Decimal } from "@interchainjs/math";
/** BondStatus is the status of a validator. */
export enum BondStatus {
/** BOND_STATUS_UNSPECIFIED - UNSPECIFIED defines an invalid validator status. */
Expand Down
113 changes: 0 additions & 113 deletions libs/cosmos-types/src/decimals.ts

This file was deleted.

2 changes: 1 addition & 1 deletion libs/cosmos-types/src/extern.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* This file and any referenced files were automatically generated by @cosmology/[email protected].20
* This file and any referenced files were automatically generated by @cosmology/[email protected].22
* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain
* and run the transpile command or npm scripts command that is used to regenerate this bundle.
*/
Expand Down
2 changes: 1 addition & 1 deletion libs/cosmos-types/src/helper-func-types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* This file and any referenced files were automatically generated by @cosmology/[email protected].20
* This file and any referenced files were automatically generated by @cosmology/[email protected].22
* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain
* and run the transpile command or npm scripts command that is used to regenerate this bundle.
*/
Expand Down
3 changes: 1 addition & 2 deletions libs/cosmos-types/src/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* This file and any referenced files were automatically generated by @cosmology/[email protected].20
* This file and any referenced files were automatically generated by @cosmology/[email protected].22
* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain
* and run the transpile command or npm scripts command that is used to regenerate this bundle.
*/
Expand Down Expand Up @@ -256,4 +256,3 @@ export function fromJsonTimestamp(o: any): Timestamp {
function numberToLong(number: number) {
return BigInt(Math.trunc(number));
}

2 changes: 1 addition & 1 deletion libs/cosmos-types/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* This file and any referenced files were automatically generated by @cosmology/[email protected].20
* This file and any referenced files were automatically generated by @cosmology/[email protected].22
* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain
* and run the transpile command or npm scripts command that is used to regenerate this bundle.
*/
Expand Down
2 changes: 1 addition & 1 deletion libs/cosmos-types/src/utf8.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* This file and any referenced files were automatically generated by @cosmology/[email protected].20
* This file and any referenced files were automatically generated by @cosmology/[email protected].22
* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain
* and run the transpile command or npm scripts command that is used to regenerate this bundle.
*/
Expand Down
2 changes: 1 addition & 1 deletion libs/cosmos-types/src/varint.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* This file and any referenced files were automatically generated by @cosmology/[email protected].20
* This file and any referenced files were automatically generated by @cosmology/[email protected].22
* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain
* and run the transpile command or npm scripts command that is used to regenerate this bundle.
*/
Expand Down
2 changes: 1 addition & 1 deletion libs/injective-react/src/binary.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* This file and any referenced files were automatically generated by @cosmology/[email protected].20
* This file and any referenced files were automatically generated by @cosmology/[email protected].22
* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain
* and run the transpile command or npm scripts command that is used to regenerate this bundle.
*/
Expand Down
6 changes: 3 additions & 3 deletions libs/injective-react/src/cosmos/base/v1beta1/coin.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BinaryReader, BinaryWriter } from "../../../binary";
import { DeepPartial } from "../../../helpers";
import { Decimal } from "../../../decimals";
import { Decimal } from "@interchainjs/math";
/**
* Coin defines a token with a denomination and an amount.
*
Expand Down Expand Up @@ -253,7 +253,7 @@ export const DecCoin = {
toAmino(message: DecCoin): DecCoinAmino {
const obj: any = {};
obj.denom = message.denom === "" ? undefined : message.denom;
obj.amount = message.amount === "" ? undefined : message.amount;
obj.amount = message.amount === "" ? undefined : Decimal.fromUserInput(message.amount, 18).atomics;
return obj;
},
fromAminoMsg(object: DecCoinAminoMsg): DecCoin {
Expand Down Expand Up @@ -407,7 +407,7 @@ export const DecProto = {
},
toAmino(message: DecProto): DecProtoAmino {
const obj: any = {};
obj.dec = message.dec === "" ? undefined : message.dec;
obj.dec = message.dec === "" ? undefined : Decimal.fromUserInput(message.dec, 18).atomics;
return obj;
},
fromAminoMsg(object: DecProtoAminoMsg): DecProto {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DecCoin, DecCoinAmino, Coin, CoinAmino } from "../../base/v1beta1/coin";
import { BinaryReader, BinaryWriter } from "../../../binary";
import { Decimal } from "../../../decimals";
import { Decimal } from "@interchainjs/math";
import { DeepPartial } from "../../../helpers";
import { GlobalDecoderRegistry } from "../../../registry";
/** Params defines the set of params for the distribution module. */
Expand Down Expand Up @@ -433,9 +433,9 @@ export const Params = {
},
toAmino(message: Params): ParamsAmino {
const obj: any = {};
obj.community_tax = message.communityTax ?? "";
obj.base_proposer_reward = message.baseProposerReward ?? "";
obj.bonus_proposer_reward = message.bonusProposerReward ?? "";
obj.community_tax = Decimal.fromUserInput(message.communityTax, 18).atomics ?? "";
obj.base_proposer_reward = Decimal.fromUserInput(message.baseProposerReward, 18).atomics ?? "";
obj.bonus_proposer_reward = Decimal.fromUserInput(message.bonusProposerReward, 18).atomics ?? "";
obj.withdraw_addr_enabled = message.withdrawAddrEnabled === false ? undefined : message.withdrawAddrEnabled;
return obj;
},
Expand Down Expand Up @@ -873,7 +873,7 @@ export const ValidatorSlashEvent = {
toAmino(message: ValidatorSlashEvent): ValidatorSlashEventAmino {
const obj: any = {};
obj.validator_period = message.validatorPeriod !== BigInt(0) ? message.validatorPeriod?.toString() : undefined;
obj.fraction = message.fraction === "" ? undefined : message.fraction;
obj.fraction = message.fraction === "" ? undefined : Decimal.fromUserInput(message.fraction, 18).atomics;
return obj;
},
fromAminoMsg(object: ValidatorSlashEventAminoMsg): ValidatorSlashEvent {
Expand Down Expand Up @@ -1254,7 +1254,7 @@ export const DelegatorStartingInfo = {
toAmino(message: DelegatorStartingInfo): DelegatorStartingInfoAmino {
const obj: any = {};
obj.previous_period = message.previousPeriod !== BigInt(0) ? message.previousPeriod?.toString() : undefined;
obj.stake = message.stake ?? "";
obj.stake = Decimal.fromUserInput(message.stake, 18).atomics ?? "";
obj.height = message.height ? message.height?.toString() : "0";
return obj;
},
Expand Down
4 changes: 2 additions & 2 deletions libs/injective-react/src/cosmos/gov/v1beta1/gov.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { BlacklistEthereumAddressesProposal, BlacklistEthereumAddressesProposalP
import { ContractRegistrationRequestProposal, ContractRegistrationRequestProposalProtoMsg, BatchContractRegistrationRequestProposal, BatchContractRegistrationRequestProposalProtoMsg, BatchContractDeregistrationProposal, BatchContractDeregistrationProposalProtoMsg, ContractRegistrationRequest, ContractRegistrationRequestProtoMsg, BatchStoreCodeProposal, BatchStoreCodeProposalProtoMsg } from "../../../injective/wasmx/v1/proposal";
import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../helpers";
import { BinaryReader, BinaryWriter } from "../../../binary";
import { Decimal } from "../../../decimals";
import { Decimal } from "@interchainjs/math";
import { GlobalDecoderRegistry } from "../../../registry";
/** VoteOption enumerates the valid vote options for a given governance proposal. */
export enum VoteOption {
Expand Down Expand Up @@ -528,7 +528,7 @@ export const WeightedVoteOption = {
toAmino(message: WeightedVoteOption): WeightedVoteOptionAmino {
const obj: any = {};
obj.option = message.option === 0 ? undefined : message.option;
obj.weight = message.weight ?? "";
obj.weight = Decimal.fromUserInput(message.weight, 18).atomics ?? "";
return obj;
},
fromAminoMsg(object: WeightedVoteOptionAminoMsg): WeightedVoteOption {
Expand Down
16 changes: 8 additions & 8 deletions libs/injective-react/src/cosmos/staking/v1beta1/staking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ValidatorUpdate, ValidatorUpdateAmino } from "../../../tendermint/abci/
import { BinaryReader, BinaryWriter } from "../../../binary";
import { GlobalDecoderRegistry } from "../../../registry";
import { DeepPartial, toTimestamp, fromTimestamp, isSet } from "../../../helpers";
import { Decimal } from "../../../decimals";
import { Decimal } from "@interchainjs/math";
import { encodePubkey, decodePubkey } from "@interchainjs/pubkey";
/** BondStatus is the status of a validator. */
export enum BondStatus {
Expand Down Expand Up @@ -918,9 +918,9 @@ export const CommissionRates = {
},
toAmino(message: CommissionRates): CommissionRatesAmino {
const obj: any = {};
obj.rate = message.rate ?? "";
obj.max_rate = message.maxRate ?? "";
obj.max_change_rate = message.maxChangeRate ?? "";
obj.rate = Decimal.fromUserInput(message.rate, 18).atomics ?? "";
obj.max_rate = Decimal.fromUserInput(message.maxRate, 18).atomics ?? "";
obj.max_change_rate = Decimal.fromUserInput(message.maxChangeRate, 18).atomics ?? "";
return obj;
},
fromAminoMsg(object: CommissionRatesAminoMsg): CommissionRates {
Expand Down Expand Up @@ -1357,7 +1357,7 @@ export const Validator = {
obj.jailed = message.jailed === false ? undefined : message.jailed;
obj.status = message.status === 0 ? undefined : message.status;
obj.tokens = message.tokens === "" ? undefined : message.tokens;
obj.delegator_shares = message.delegatorShares === "" ? undefined : message.delegatorShares;
obj.delegator_shares = message.delegatorShares === "" ? undefined : Decimal.fromUserInput(message.delegatorShares, 18).atomics;
obj.description = message.description ? Description.toAmino(message.description) : Description.toAmino(Description.fromPartial({}));
obj.unbonding_height = message.unbondingHeight !== BigInt(0) ? message.unbondingHeight?.toString() : undefined;
obj.unbonding_time = message.unbondingTime ? Timestamp.toAmino(toTimestamp(message.unbondingTime)) : new Date();
Expand Down Expand Up @@ -1903,7 +1903,7 @@ export const Delegation = {
const obj: any = {};
obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress;
obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress;
obj.shares = message.shares === "" ? undefined : message.shares;
obj.shares = message.shares === "" ? undefined : Decimal.fromUserInput(message.shares, 18).atomics;
return obj;
},
fromAminoMsg(object: DelegationAminoMsg): Delegation {
Expand Down Expand Up @@ -2280,7 +2280,7 @@ export const RedelegationEntry = {
obj.creation_height = message.creationHeight !== BigInt(0) ? message.creationHeight?.toString() : undefined;
obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : new Date();
obj.initial_balance = message.initialBalance === "" ? undefined : message.initialBalance;
obj.shares_dst = message.sharesDst === "" ? undefined : message.sharesDst;
obj.shares_dst = message.sharesDst === "" ? undefined : Decimal.fromUserInput(message.sharesDst, 18).atomics;
obj.unbonding_id = message.unbondingId !== BigInt(0) ? message.unbondingId?.toString() : undefined;
obj.unbonding_on_hold_ref_count = message.unbondingOnHoldRefCount !== BigInt(0) ? message.unbondingOnHoldRefCount?.toString() : undefined;
return obj;
Expand Down Expand Up @@ -2536,7 +2536,7 @@ export const Params = {
obj.max_entries = message.maxEntries === 0 ? undefined : message.maxEntries;
obj.historical_entries = message.historicalEntries === 0 ? undefined : message.historicalEntries;
obj.bond_denom = message.bondDenom === "" ? undefined : message.bondDenom;
obj.min_commission_rate = message.minCommissionRate ?? "";
obj.min_commission_rate = Decimal.fromUserInput(message.minCommissionRate, 18).atomics ?? "";
return obj;
},
fromAminoMsg(object: ParamsAminoMsg): Params {
Expand Down
4 changes: 2 additions & 2 deletions libs/injective-react/src/cosmos/staking/v1beta1/tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { BinaryReader, BinaryWriter } from "../../../binary";
import { GlobalDecoderRegistry } from "../../../registry";
import { DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers";
import { encodePubkey, decodePubkey } from "@interchainjs/pubkey";
import { Decimal } from "../../../decimals";
import { Decimal } from "@interchainjs/math";
/** MsgCreateValidator defines a SDK message for creating a new validator. */
export interface MsgCreateValidator {
description: Description;
Expand Down Expand Up @@ -659,7 +659,7 @@ export const MsgEditValidator = {
const obj: any = {};
obj.description = message.description ? Description.toAmino(message.description) : Description.toAmino(Description.fromPartial({}));
obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress;
obj.commission_rate = message.commissionRate === "" ? undefined : message.commissionRate;
obj.commission_rate = message.commissionRate === "" ? undefined : Decimal.fromUserInput(message.commissionRate, 18).atomics;
obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation;
return obj;
},
Expand Down
Loading

0 comments on commit bd51489

Please sign in to comment.