diff --git a/.gitignore b/.gitignore index 6e55df51..f4100c52 100644 --- a/.gitignore +++ b/.gitignore @@ -2,10 +2,6 @@ # Edit at https://www.gitignore.io/?templates=node,intellij+all,visualstudiocode docs/ -src/protojs/ -proto/ -src/gql/utils/generated.ts -src/gql/utils/schema.graphql dist **/node_modules/* diff --git a/nibiru b/nibiru index 3199ae53..3aac9370 160000 --- a/nibiru +++ b/nibiru @@ -1 +1 @@ -Subproject commit 3199ae538bc2e1f4bb8d06727d0d10b96c6822a8 +Subproject commit 3aac9370f01a344427f0e3500e9148401ba92293 diff --git a/src/gql/utils/generated.ts b/src/gql/utils/generated.ts new file mode 100644 index 00000000..26042cd8 --- /dev/null +++ b/src/gql/utils/generated.ts @@ -0,0 +1,909 @@ +export type Maybe = T | null; +export type InputMaybe = Maybe; +export type Exact = { [K in keyof T]: T[K] }; +export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; +export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; +/** All built-in and custom scalars, mapped to their actual values */ +export type Scalars = { + ID: { input: string; output: string; } + String: { input: string; output: string; } + Boolean: { input: boolean; output: boolean; } + Int: { input: number; output: number; } + Float: { input: number; output: number; } + Time: { input: string; output: string; } +}; + +export type GQLBlock = { + readonly __typename?: 'Block'; + readonly block: Scalars['Int']['output']; + readonly block_duration: Scalars['Float']['output']; + readonly block_ts: Scalars['Int']['output']; + readonly num_txs: Scalars['Int']['output']; +}; + +export type GQLBybitResponse = { + readonly __typename?: 'BybitResponse'; + readonly ask1Price: Scalars['String']['output']; + readonly ask1Size: Scalars['String']['output']; + readonly bid1Price: Scalars['String']['output']; + readonly bid1Size: Scalars['String']['output']; + readonly highPrice24h: Scalars['String']['output']; + readonly lastPrice: Scalars['String']['output']; + readonly lowPrice24h: Scalars['String']['output']; + readonly prevPrice24h: Scalars['String']['output']; + readonly price24hPcnt: Scalars['String']['output']; + readonly symbol: Scalars['String']['output']; + readonly turnover24h: Scalars['String']['output']; + readonly volume24h: Scalars['String']['output']; +}; + +export type GQLCommunityPoolFilter = { + readonly denom?: InputMaybe; +}; + +export enum GQLCommunityPoolOrder { + GQLDenom = 'denom' +} + +export type GQLContractEventsFilter = { + readonly block?: InputMaybe; + readonly contractAddress?: InputMaybe; + readonly type?: InputMaybe; +}; + +export enum GQLContractEventsOrder { + GQLContractAddress = 'contract_address', + GQLSequence = 'sequence', + GQLType = 'type' +} + +export type GQLDelegation = { + readonly __typename?: 'Delegation'; + readonly amount: Scalars['Int']['output']; + readonly delegator: GQLUser; + readonly validator: GQLValidator; +}; + +export type GQLDelegationFilter = { + readonly delegator_address?: InputMaybe; + readonly validator_address?: InputMaybe; +}; + +export enum GQLDelegationOrder { + GQLDelegatorAddress = 'delegator_address', + GQLValidatorAddress = 'validator_address' +} + +export type GQLDistributionCommission = { + readonly __typename?: 'DistributionCommission'; + readonly commission?: Maybe; + readonly validator: GQLValidator; +}; + +export type GQLDistributionCommissionFilter = { + readonly validator_address?: InputMaybe; +}; + +export enum GQLDistributionCommissionOrder { + GQLValidatorAddress = 'validator_address' +} + +export type GQLEmployee = { + readonly __typename?: 'Employee'; + readonly email: Scalars['String']['output']; + readonly instagram: Scalars['String']['output']; + readonly name: Scalars['String']['output']; + readonly phone: Scalars['String']['output']; + readonly telegram: Scalars['String']['output']; + readonly twitter: Scalars['String']['output']; +}; + +export type GQLEmployeeFilter = { + readonly email?: InputMaybe; + readonly instagram?: InputMaybe; + readonly name?: InputMaybe; + readonly phone?: InputMaybe; + readonly telegram?: InputMaybe; + readonly twitter?: InputMaybe; +}; + +export type GQLEvent = { + readonly __typename?: 'Event'; + readonly attributes: ReadonlyArray; + readonly block: GQLBlock; + readonly contractAddress?: Maybe; + readonly eventSeqNo: Scalars['Int']['output']; + readonly txSeqNo: Scalars['Int']['output']; + readonly type: Scalars['String']['output']; +}; + +export type GQLEventAttribute = { + readonly __typename?: 'EventAttribute'; + readonly key: Scalars['String']['output']; + readonly value: Scalars['String']['output']; +}; + +export type GQLFeatureFlags = { + readonly __typename?: 'FeatureFlags'; + readonly gov: Scalars['Boolean']['output']; + readonly oracle: Scalars['Boolean']['output']; + readonly staking: Scalars['Boolean']['output']; + readonly wasm: Scalars['Boolean']['output']; +}; + +export type GQLFloatFilter = { + readonly eq?: InputMaybe; + readonly gt?: InputMaybe; + readonly gte?: InputMaybe; + readonly lt?: InputMaybe; + readonly lte?: InputMaybe; +}; + +export type GQLGovDeposit = { + readonly __typename?: 'GovDeposit'; + readonly amount: ReadonlyArray; + readonly block: GQLBlock; + readonly proposal: GQLGovProposal; + readonly sender: GQLUser; +}; + +export type GQLGovDepositsFilter = { + readonly block?: InputMaybe; + readonly proposalId?: InputMaybe; + readonly senderEq?: InputMaybe; +}; + +export enum GQLGovDepositsOrder { + GQLBlock = 'block', + GQLProposalId = 'proposal_id', + GQLSender = 'sender' +} + +export type GQLGovProposal = { + readonly __typename?: 'GovProposal'; + readonly depositEndTime: Scalars['Time']['output']; + readonly finalTallyResultAbstain: Scalars['Int']['output']; + readonly finalTallyResultNo: Scalars['Int']['output']; + readonly finalTallyResultNoWithVeto: Scalars['Int']['output']; + readonly finalTallyResultYes: Scalars['Int']['output']; + readonly id: Scalars['Int']['output']; + readonly metadata: Scalars['String']['output']; + readonly proposer: GQLUser; + readonly status: Scalars['String']['output']; + readonly submitTime: Scalars['Time']['output']; + readonly summary: Scalars['String']['output']; + readonly title: Scalars['String']['output']; + readonly totalDeposit: ReadonlyArray; + readonly votingEndTime?: Maybe; + readonly votingStartTime?: Maybe; +}; + +export type GQLGovProposalsFilter = { + readonly depositEndTime?: InputMaybe; + readonly finalTallyResultAbstain?: InputMaybe; + readonly finalTallyResultNo?: InputMaybe; + readonly finalTallyResultNoWithVeto?: InputMaybe; + readonly finalTallyResultYes?: InputMaybe; + readonly id?: InputMaybe; + readonly proposerEq?: InputMaybe; + readonly submitTime?: InputMaybe; + readonly summary?: InputMaybe; + readonly title?: InputMaybe; + readonly votingEndTime?: InputMaybe; + readonly votingStartTime?: InputMaybe; +}; + +export enum GQLGovProposalsOrder { + GQLDepositEndTime = 'deposit_end_time', + GQLFinalTallyResultAbstain = 'final_tally_result_abstain', + GQLFinalTallyResultNo = 'final_tally_result_no', + GQLFinalTallyResultNoWithVeto = 'final_tally_result_no_with_veto', + GQLFinalTallyResultYes = 'final_tally_result_yes', + GQLId = 'id', + GQLProposer = 'proposer', + GQLStatus = 'status', + GQLSubmitTime = 'submit_time', + GQLSummary = 'summary', + GQLTitle = 'title', + GQLVotingEndTime = 'voting_end_time', + GQLVotingStartTime = 'voting_start_time' +} + +export type GQLGovVote = { + readonly __typename?: 'GovVote'; + readonly block: GQLBlock; + readonly option: Scalars['String']['output']; + readonly proposal: GQLGovProposal; + readonly sender: GQLUser; +}; + +export type GQLGovVotesFilter = { + readonly block?: InputMaybe; + readonly optionEq?: InputMaybe; + readonly proposalId?: InputMaybe; + readonly senderEq?: InputMaybe; +}; + +export enum GQLGovVotesOrder { + GQLBlock = 'block', + GQLOption = 'option', + GQLProposalId = 'proposal_id', + GQLSender = 'sender' +} + +export type GQLGovernance = { + readonly __typename?: 'Governance'; + readonly govDeposits: ReadonlyArray; + readonly govProposals: ReadonlyArray; + readonly govVotes: ReadonlyArray; +}; + + +export type GQLGovernanceGqlGovDepositsArgs = { + limit?: InputMaybe; + order?: InputMaybe; + orderDesc?: InputMaybe; + where?: InputMaybe; +}; + + +export type GQLGovernanceGqlGovProposalsArgs = { + limit?: InputMaybe; + order?: InputMaybe; + orderDesc?: InputMaybe; + where?: InputMaybe; +}; + + +export type GQLGovernanceGqlGovVotesArgs = { + limit?: InputMaybe; + order?: InputMaybe; + orderDesc?: InputMaybe; + where?: InputMaybe; +}; + +export type GQLIbc = { + readonly __typename?: 'IBC'; + readonly ibcChannels: GQLIbcChannelsResponse; + readonly ibcTransfers: ReadonlyArray; +}; + + +export type GQLIbcgqlIbcTransfersArgs = { + limit?: InputMaybe; + offset?: InputMaybe; + order_by?: InputMaybe; + order_desc?: InputMaybe; + where?: InputMaybe; +}; + +export type GQLIbcChannel = { + readonly __typename?: 'IBCChannel'; + readonly chain_id: Scalars['String']['output']; + readonly chain_logo: Scalars['String']['output']; + readonly chain_name: Scalars['String']['output']; + readonly channel_id: Scalars['String']['output']; + readonly counterparty_channel_id: Scalars['String']['output']; + readonly revision_height: Scalars['Int']['output']; +}; + +export type GQLIbcChannelsResponse = { + readonly __typename?: 'IBCChannelsResponse'; + readonly channels: ReadonlyArray; + readonly revision_height: Scalars['Int']['output']; +}; + +export type GQLIbcTranferFilter = { + readonly receiver?: InputMaybe; + readonly sender?: InputMaybe; +}; + +export enum GQLIbcTranferOrder { + GQLBlock = 'block', + GQLReceiver = 'receiver', + GQLSender = 'sender' +} + +export type GQLIbcTransfer = { + readonly __typename?: 'IBCTransfer'; + readonly amount: Scalars['Float']['output']; + readonly block: GQLBlock; + readonly denom: Scalars['String']['output']; + readonly memo: Scalars['String']['output']; + readonly receiver: Scalars['String']['output']; + readonly sender: Scalars['String']['output']; +}; + +export type GQLInflation = { + readonly __typename?: 'Inflation'; + readonly distributions: ReadonlyArray; + readonly inflations: ReadonlyArray; + readonly rewards?: Maybe; +}; + + +export type GQLInflationGqlDistributionsArgs = { + limit?: InputMaybe; + offset?: InputMaybe; + order_by?: InputMaybe; + order_desc?: InputMaybe; + where?: InputMaybe; +}; + + +export type GQLInflationGqlInflationsArgs = { + limit?: InputMaybe; + offset?: InputMaybe; + order_by?: InputMaybe; + order_desc?: InputMaybe; + where?: InputMaybe; +}; + +export type GQLInflationDistribution = { + readonly __typename?: 'InflationDistribution'; + readonly block: GQLBlock; + readonly communityPool: Scalars['Float']['output']; + readonly eventSeqNo: Scalars['Int']['output']; + readonly stakingRewards: Scalars['Float']['output']; + readonly strategicReserve: Scalars['Float']['output']; + readonly txSeqNo: Scalars['Int']['output']; +}; + +export type GQLInflationDistributionFilter = { + readonly block?: InputMaybe; + readonly blockTs?: InputMaybe; +}; + +export enum GQLInflationDistributionOrder { + GQLSequence = 'sequence' +} + +export type GQLInflationInfo = { + readonly __typename?: 'InflationInfo'; + readonly amount: Scalars['Float']['output']; + readonly block: GQLBlock; + readonly epochNumber: Scalars['Int']['output']; + readonly epochProvisions: Scalars['Float']['output']; +}; + +export type GQLInflationInfoFilter = { + readonly block?: InputMaybe; + readonly blockTs?: InputMaybe; + readonly epochNumber?: InputMaybe; +}; + +export enum GQLInflationInfoOrder { + GQLBlock = 'block', + GQLEpochNumber = 'epoch_number' +} + +export type GQLInflationRewards = { + readonly __typename?: 'InflationRewards'; + readonly annualReward: Scalars['Int']['output']; + readonly totalStaked: Scalars['Int']['output']; +}; + +export type GQLIntFilter = { + readonly eq?: InputMaybe; + readonly gt?: InputMaybe; + readonly gte?: InputMaybe; + readonly lt?: InputMaybe; + readonly lte?: InputMaybe; +}; + +export type GQLInternal = { + readonly __typename?: 'Internal'; + readonly employee?: Maybe; +}; + + +export type GQLInternalGqlEmployeeArgs = { + where: GQLEmployeeFilter; +}; + +export type GQLMessage = { + readonly __typename?: 'Message'; + readonly action?: Maybe; + readonly block: GQLBlock; + readonly contractAddr?: Maybe; + readonly funds?: Maybe>; + readonly msgSeqNo: Scalars['Int']['output']; + readonly senderAddr?: Maybe; + readonly txCode: Scalars['Int']['output']; + readonly txHash: Scalars['String']['output']; + readonly txSeqNo: Scalars['Int']['output']; + readonly type: Scalars['String']['output']; +}; + +export type GQLMessagesFilter = { + readonly block?: InputMaybe; + readonly senderAddr?: InputMaybe; + readonly txHash?: InputMaybe; + readonly type?: InputMaybe; +}; + +export enum GQLMessagesOrder { + GQLSequence = 'sequence', + GQLType = 'type' +} + +export type GQLOracle = { + readonly __typename?: 'Oracle'; + readonly oraclePrices: ReadonlyArray; + readonly oracles: ReadonlyArray; +}; + + +export type GQLOracleGqlOraclePricesArgs = { + limit?: InputMaybe; + offset?: InputMaybe; + order_by?: InputMaybe; + order_desc?: InputMaybe; + where?: InputMaybe; +}; + + +export type GQLOracleGqlOraclesArgs = { + limit?: InputMaybe; + order_by?: InputMaybe; + order_desc?: InputMaybe; + where?: InputMaybe; +}; + +export type GQLOracleEntry = { + readonly __typename?: 'OracleEntry'; + readonly numVotes: Scalars['Int']['output']; + readonly validator: GQLValidator; +}; + +export type GQLOraclePrice = { + readonly __typename?: 'OraclePrice'; + readonly block: GQLBlock; + /** @deprecated Not applicable for oracle prices */ + readonly eventSeqNo: Scalars['Int']['output']; + readonly pair: Scalars['String']['output']; + readonly price: Scalars['Float']['output']; + /** @deprecated Not applicable for oracle prices */ + readonly txSeqNo: Scalars['Int']['output']; +}; + +export type GQLOraclePricesFilter = { + readonly block?: InputMaybe; + readonly pair?: InputMaybe; +}; + +export enum GQLOraclePricesOrder { + GQLPair = 'pair', + GQLPrice = 'price', + GQLSequence = 'sequence' +} + +export type GQLOraclesFilter = { + readonly numVotes?: InputMaybe; + readonly validatorAddressEq?: InputMaybe; +}; + +export enum GQLOraclesOrder { + GQLNumVotes = 'num_votes', + GQLValidatorAddress = 'validator_address' +} + +export type GQLProxies = { + readonly __typename?: 'Proxies'; + readonly bybit: GQLBybitResponse; +}; + +export type GQLQuery = { + readonly __typename?: 'Query'; + readonly communityPool: ReadonlyArray; + /** @deprecated Moved to staking sub schema */ + readonly delegations: ReadonlyArray; + readonly distributionCommissions: ReadonlyArray; + readonly featureFlags: GQLFeatureFlags; + readonly governance: GQLGovernance; + readonly ibc: GQLIbc; + readonly inflation: GQLInflation; + readonly internal: GQLInternal; + readonly messages: ReadonlyArray; + readonly oracle: GQLOracle; + readonly proxies: GQLProxies; + /** @deprecated Moved to staking sub schema */ + readonly redelegations: ReadonlyArray; + readonly staking: GQLStaking; + /** @deprecated Will be removed next release */ + readonly stats: GQLStats; + /** @deprecated Moved to staking sub schema */ + readonly unbondings: ReadonlyArray; + readonly user?: Maybe; + readonly users: ReadonlyArray; + /** @deprecated Moved to staking sub schema */ + readonly validators: ReadonlyArray; + readonly wasm: GQLWasm; +}; + + +export type GQLQueryGqlCommunityPoolArgs = { + limit?: InputMaybe; + order_by?: InputMaybe; + order_desc?: InputMaybe; + where?: InputMaybe; +}; + + +export type GQLQueryGqlDelegationsArgs = { + limit?: InputMaybe; + order_by?: InputMaybe; + order_desc?: InputMaybe; + where?: InputMaybe; +}; + + +export type GQLQueryGqlDistributionCommissionsArgs = { + limit?: InputMaybe; + order_by?: InputMaybe; + order_desc?: InputMaybe; + where?: InputMaybe; +}; + + +export type GQLQueryGqlMessagesArgs = { + limit?: InputMaybe; + offset?: InputMaybe; + order_by?: InputMaybe; + order_desc?: InputMaybe; + where?: InputMaybe; +}; + + +export type GQLQueryGqlRedelegationsArgs = { + limit?: InputMaybe; + order_by?: InputMaybe; + order_desc?: InputMaybe; + where?: InputMaybe; +}; + + +export type GQLQueryGqlUnbondingsArgs = { + limit?: InputMaybe; + order_by?: InputMaybe; + order_desc?: InputMaybe; + where?: InputMaybe; +}; + + +export type GQLQueryGqlUserArgs = { + where: GQLUserFilter; +}; + + +export type GQLQueryGqlUsersArgs = { + limit?: InputMaybe; + order_by?: InputMaybe; + order_desc?: InputMaybe; + where?: InputMaybe; +}; + + +export type GQLQueryGqlValidatorsArgs = { + limit?: InputMaybe; + order_by?: InputMaybe; + order_desc?: InputMaybe; + where?: InputMaybe; +}; + +export type GQLRedelegation = { + readonly __typename?: 'Redelegation'; + readonly amount: Scalars['Int']['output']; + readonly completion_time: Scalars['String']['output']; + readonly creation_block: GQLBlock; + readonly delegator: GQLUser; + readonly destination_validator: GQLValidator; + readonly source_validator: GQLValidator; +}; + +export type GQLRedelegationFilter = { + readonly delegator_address?: InputMaybe; + readonly destination_validator_address?: InputMaybe; + readonly source_validator_address?: InputMaybe; +}; + +export enum GQLRedelegationOrder { + GQLCompletionTime = 'completion_time', + GQLCreationHeight = 'creation_height', + GQLDelegatorAddress = 'delegator_address', + GQLDestinationValidatorAddress = 'destination_validator_address', + GQLSourceValidatorAddress = 'source_validator_address' +} + +export type GQLStaking = { + readonly __typename?: 'Staking'; + readonly delegations: ReadonlyArray; + readonly history: ReadonlyArray; + readonly redelegations: ReadonlyArray; + readonly unbondings: ReadonlyArray; + readonly validators: ReadonlyArray; +}; + + +export type GQLStakingGqlDelegationsArgs = { + limit?: InputMaybe; + offset?: InputMaybe; + order_by?: InputMaybe; + order_desc?: InputMaybe; + where?: InputMaybe; +}; + + +export type GQLStakingGqlHistoryArgs = { + limit?: InputMaybe; + offset?: InputMaybe; + order_by?: InputMaybe; + order_desc?: InputMaybe; + where?: InputMaybe; +}; + + +export type GQLStakingGqlRedelegationsArgs = { + limit?: InputMaybe; + offset?: InputMaybe; + order_by?: InputMaybe; + order_desc?: InputMaybe; + where?: InputMaybe; +}; + + +export type GQLStakingGqlUnbondingsArgs = { + limit?: InputMaybe; + offset?: InputMaybe; + order_by?: InputMaybe; + order_desc?: InputMaybe; + where?: InputMaybe; +}; + + +export type GQLStakingGqlValidatorsArgs = { + limit?: InputMaybe; + offset?: InputMaybe; + order_by?: InputMaybe; + order_desc?: InputMaybe; + where?: InputMaybe; +}; + +export enum GQLStakingActionType { + GQLCancel = 'cancel', + GQLDelegate = 'delegate', + GQLRedelegate = 'redelegate', + GQLRedelegateCompleted = 'redelegate_completed', + GQLUnbond = 'unbond', + GQLUnbondCompleted = 'unbond_completed', + GQLWithdraw = 'withdraw' +} + +export type GQLStakingHistoryFilter = { + readonly actions?: InputMaybe>; + readonly amount?: InputMaybe; + readonly block?: InputMaybe; + readonly completionTime?: InputMaybe; + readonly delegator?: InputMaybe; + readonly validator?: InputMaybe; +}; + +export type GQLStakingHistoryItem = { + readonly __typename?: 'StakingHistoryItem'; + readonly action: GQLStakingActionType; + readonly amount: Scalars['Int']['output']; + readonly block: GQLBlock; + readonly completion_time?: Maybe; + readonly delegator: GQLUser; + readonly destination_validator?: Maybe; + readonly validator: GQLValidator; +}; + +export enum GQLStakingHistoryOrder { + GQLAction = 'action', + GQLAmount = 'amount', + GQLDelegator = 'delegator', + GQLSequence = 'sequence', + GQLValidator = 'validator' +} + +export type GQLStats = { + readonly __typename?: 'Stats'; + readonly volume: ReadonlyArray; +}; + + +export type GQLStatsGqlVolumeArgs = { + limit?: InputMaybe; + order?: InputMaybe; + orderDesc?: InputMaybe; +}; + +export type GQLStatsVolume = { + readonly __typename?: 'StatsVolume'; + readonly periodStartTs: Scalars['Time']['output']; + readonly volumePerpCumulative: Scalars['Float']['output']; +}; + +export enum GQLStatsVolumeOrder { + GQLPeriodStartTs = 'period_start_ts' +} + +export type GQLStringFilter = { + readonly eq?: InputMaybe; + readonly like?: InputMaybe; +}; + +export type GQLSubOraclePricesFilter = { + readonly pair: Scalars['String']['input']; +}; + +export type GQLSubscription = { + readonly __typename?: 'Subscription'; + readonly oraclePrices: ReadonlyArray; +}; + + +export type GQLSubscriptionGqlOraclePricesArgs = { + where?: InputMaybe; +}; + +export type GQLTimeFilter = { + readonly eq?: InputMaybe; + readonly gt?: InputMaybe; + readonly gte?: InputMaybe; + readonly lt?: InputMaybe; + readonly lte?: InputMaybe; +}; + +export type GQLToken = { + readonly __typename?: 'Token'; + readonly amount: Scalars['String']['output']; + readonly denom: Scalars['String']['output']; +}; + +export type GQLUnbonding = { + readonly __typename?: 'Unbonding'; + readonly amount: Scalars['Int']['output']; + readonly completion_time: Scalars['String']['output']; + readonly creation_block: GQLBlock; + readonly delegator: GQLUser; + readonly validator: GQLValidator; +}; + +export type GQLUnbondingFilter = { + readonly delegator_address?: InputMaybe; + readonly validator_address?: InputMaybe; +}; + +export enum GQLUnbondingOrder { + GQLCompletionTime = 'completion_time', + GQLCreationHeight = 'creation_height', + GQLDelegatorAddress = 'delegator_address', + GQLValidatorAddress = 'validator_address' +} + +export type GQLUser = { + readonly __typename?: 'User'; + readonly address: Scalars['String']['output']; + readonly balances: ReadonlyArray>; + readonly created_block: GQLBlock; + readonly is_blocked?: Maybe; +}; + +export type GQLUserContract = { + readonly __typename?: 'UserContract'; + readonly contractAddress: Scalars['String']['output']; + readonly contractType: Scalars['String']['output']; + readonly events?: Maybe>; + readonly user: GQLUser; +}; + +export type GQLUserContractsFilter = { + readonly contractAddress?: InputMaybe; + readonly contractType?: InputMaybe; + readonly userAddress?: InputMaybe; +}; + +export enum GQLUserContractsOrder { + GQLContractAddress = 'contract_address', + GQLContractType = 'contract_type', + GQLUserAddress = 'user_address' +} + +export type GQLUserFilter = { + readonly address: Scalars['String']['input']; +}; + +export enum GQLUserOrder { + GQLAddress = 'address', + GQLCreatedBlock = 'created_block' +} + +export type GQLUsersFilter = { + readonly address?: InputMaybe; + readonly created_block_eq?: InputMaybe; + readonly created_block_gte?: InputMaybe; + readonly created_block_lte?: InputMaybe; +}; + +export type GQLValidator = { + readonly __typename?: 'Validator'; + readonly commission_rates?: Maybe; + readonly commission_update_time: Scalars['String']['output']; + readonly creation_block: GQLBlock; + readonly delegator_shares: Scalars['Float']['output']; + readonly description: GQLValidatorDescription; + readonly jailed: Scalars['Boolean']['output']; + readonly min_self_delegation: Scalars['Int']['output']; + readonly operator_address: Scalars['String']['output']; + readonly self_delegation: Scalars['Int']['output']; + readonly status: GQLValidatorStatus; + readonly tokens: Scalars['Int']['output']; + readonly unbonding_block: GQLBlock; + readonly unbonding_time: Scalars['String']['output']; + readonly uptime?: Maybe; +}; + +export type GQLValidatorCommission = { + readonly __typename?: 'ValidatorCommission'; + readonly max_change_rate: Scalars['Float']['output']; + readonly max_rate: Scalars['Float']['output']; + readonly rate: Scalars['Float']['output']; +}; + +export type GQLValidatorDescription = { + readonly __typename?: 'ValidatorDescription'; + readonly details: Scalars['String']['output']; + readonly identity: Scalars['String']['output']; + readonly moniker: Scalars['String']['output']; + readonly security_contact: Scalars['String']['output']; + readonly website: Scalars['String']['output']; +}; + +export type GQLValidatorFilter = { + readonly jailed?: InputMaybe; + readonly moniker?: InputMaybe; + readonly operator_address?: InputMaybe; + readonly status?: InputMaybe; +}; + +export enum GQLValidatorOrder { + GQLJailed = 'jailed', + GQLMoniker = 'moniker', + GQLOperatorAddress = 'operator_address', + GQLStatus = 'status', + GQLTokens = 'tokens' +} + +export enum GQLValidatorStatus { + GQLBonded = 'BONDED', + GQLUnbonded = 'UNBONDED', + GQLUnbonding = 'UNBONDING' +} + +export type GQLWasm = { + readonly __typename?: 'Wasm'; + readonly contractEvents: ReadonlyArray; + readonly userContracts: ReadonlyArray; +}; + + +export type GQLWasmGqlContractEventsArgs = { + limit?: InputMaybe; + offset?: InputMaybe; + order?: InputMaybe; + orderDesc?: InputMaybe; + where?: InputMaybe; +}; + + +export type GQLWasmGqlUserContractsArgs = { + limit?: InputMaybe; + offset?: InputMaybe; + order?: InputMaybe; + orderDesc?: InputMaybe; + where?: InputMaybe; +}; diff --git a/src/gql/utils/schema.graphql b/src/gql/utils/schema.graphql new file mode 100644 index 00000000..12d18e93 --- /dev/null +++ b/src/gql/utils/schema.graphql @@ -0,0 +1,630 @@ +directive @goModel(model: String, models: [String!]) on ENUM | INPUT_OBJECT | INTERFACE | OBJECT | SCALAR | UNION + +type Block { + block: Int! + block_duration: Float! + block_ts: Int! + num_txs: Int! +} + +type BybitResponse { + ask1Price: String! + ask1Size: String! + bid1Price: String! + bid1Size: String! + highPrice24h: String! + lastPrice: String! + lowPrice24h: String! + prevPrice24h: String! + price24hPcnt: String! + symbol: String! + turnover24h: String! + volume24h: String! +} + +input CommunityPoolFilter { + denom: String +} + +enum CommunityPoolOrder { + denom +} + +input ContractEventsFilter { + block: IntFilter + contractAddress: StringFilter + type: StringFilter +} + +enum ContractEventsOrder { + contract_address + sequence + type +} + +type Delegation { + amount: Int! + delegator: User! + validator: Validator! +} + +input DelegationFilter { + delegator_address: String + validator_address: String +} + +enum DelegationOrder { + delegator_address + validator_address +} + +type DistributionCommission { + commission: Token + validator: Validator! +} + +input DistributionCommissionFilter { + validator_address: String +} + +enum DistributionCommissionOrder { + validator_address +} + +type Employee { + email: String! + instagram: String! + name: String! + phone: String! + telegram: String! + twitter: String! +} + +input EmployeeFilter { + email: String + instagram: String + name: String + phone: String + telegram: String + twitter: String +} + +type Event { + attributes: [EventAttribute!]! + block: Block! + contractAddress: String + eventSeqNo: Int! + txSeqNo: Int! + type: String! +} + +type EventAttribute { + key: String! + value: String! +} + +type FeatureFlags { + gov: Boolean! + oracle: Boolean! + staking: Boolean! + wasm: Boolean! +} + +input FloatFilter { + eq: Float + gt: Float + gte: Float + lt: Float + lte: Float +} + +type GovDeposit { + amount: [Token!]! + block: Block! + proposal: GovProposal! + sender: User! +} + +input GovDepositsFilter { + block: IntFilter + proposalId: IntFilter + senderEq: String +} + +enum GovDepositsOrder { + block + proposal_id + sender +} + +type GovProposal { + depositEndTime: Time! + finalTallyResultAbstain: Int! + finalTallyResultNo: Int! + finalTallyResultNoWithVeto: Int! + finalTallyResultYes: Int! + id: Int! + metadata: String! + proposer: User! + status: String! + submitTime: Time! + summary: String! + title: String! + totalDeposit: [Token!]! + votingEndTime: Time + votingStartTime: Time +} + +input GovProposalsFilter { + depositEndTime: TimeFilter + finalTallyResultAbstain: IntFilter + finalTallyResultNo: IntFilter + finalTallyResultNoWithVeto: IntFilter + finalTallyResultYes: IntFilter + id: IntFilter + proposerEq: String + submitTime: TimeFilter + summary: StringFilter + title: StringFilter + votingEndTime: TimeFilter + votingStartTime: TimeFilter +} + +enum GovProposalsOrder { + deposit_end_time + final_tally_result_abstain + final_tally_result_no + final_tally_result_no_with_veto + final_tally_result_yes + id + proposer + status + submit_time + summary + title + voting_end_time + voting_start_time +} + +type GovVote { + block: Block! + option: String! + proposal: GovProposal! + sender: User! +} + +input GovVotesFilter { + block: IntFilter + optionEq: String + proposalId: IntFilter + senderEq: String +} + +enum GovVotesOrder { + block + option + proposal_id + sender +} + +type Governance { + govDeposits(limit: Int, order: GovDepositsOrder, orderDesc: Boolean, where: GovDepositsFilter): [GovDeposit!]! + govProposals(limit: Int, order: GovProposalsOrder, orderDesc: Boolean, where: GovProposalsFilter): [GovProposal!]! + govVotes(limit: Int, order: GovVotesOrder, orderDesc: Boolean, where: GovVotesFilter): [GovVote!]! +} + +type IBC { + ibcChannels: IBCChannelsResponse! + ibcTransfers(limit: Int, offset: Int, order_by: IBCTranferOrder, order_desc: Boolean, where: IBCTranferFilter): [IBCTransfer!]! +} + +type IBCChannel { + chain_id: String! + chain_logo: String! + chain_name: String! + channel_id: String! + counterparty_channel_id: String! + revision_height: Int! +} + +type IBCChannelsResponse { + channels: [IBCChannel!]! + revision_height: Int! +} + +input IBCTranferFilter { + receiver: String + sender: String +} + +enum IBCTranferOrder { + block + receiver + sender +} + +type IBCTransfer { + amount: Float! + block: Block! + denom: String! + memo: String! + receiver: String! + sender: String! +} + +type Inflation { + distributions(limit: Int, offset: Int, order_by: InflationDistributionOrder, order_desc: Boolean, where: InflationDistributionFilter): [InflationDistribution!]! + inflations(limit: Int, offset: Int, order_by: InflationInfoOrder, order_desc: Boolean, where: InflationInfoFilter): [InflationInfo!]! + rewards: InflationRewards +} + +type InflationDistribution { + block: Block! + communityPool: Float! + eventSeqNo: Int! + stakingRewards: Float! + strategicReserve: Float! + txSeqNo: Int! +} + +input InflationDistributionFilter { + block: IntFilter + blockTs: TimeFilter +} + +enum InflationDistributionOrder { + sequence +} + +type InflationInfo { + amount: Float! + block: Block! + epochNumber: Int! + epochProvisions: Float! +} + +input InflationInfoFilter { + block: IntFilter + blockTs: TimeFilter + epochNumber: IntFilter +} + +enum InflationInfoOrder { + block + epoch_number +} + +type InflationRewards { + annualReward: Int! + totalStaked: Int! +} + +input IntFilter { + eq: Int + gt: Int + gte: Int + lt: Int + lte: Int +} + +type Internal { + employee(where: EmployeeFilter!): Employee +} + +type Message { + action: String + block: Block! + contractAddr: String + funds: [Token!] + msgSeqNo: Int! + senderAddr: String + txCode: Int! + txHash: String! + txSeqNo: Int! + type: String! +} + +input MessagesFilter { + block: IntFilter + senderAddr: String + txHash: String + type: String +} + +enum MessagesOrder { + sequence + type +} + +type Oracle { + oraclePrices(limit: Int, offset: Int, order_by: OraclePricesOrder, order_desc: Boolean, where: OraclePricesFilter): [OraclePrice!]! + oracles(limit: Int, order_by: OraclesOrder, order_desc: Boolean, where: OraclesFilter): [OracleEntry!]! +} + +type OracleEntry { + numVotes: Int! + validator: Validator! +} + +type OraclePrice { + block: Block! + eventSeqNo: Int! @deprecated(reason: "Not applicable for oracle prices") + pair: String! + price: Float! + txSeqNo: Int! @deprecated(reason: "Not applicable for oracle prices") +} + +input OraclePricesFilter { + block: IntFilter + pair: StringFilter +} + +enum OraclePricesOrder { + pair + price + sequence +} + +input OraclesFilter { + numVotes: IntFilter + validatorAddressEq: String +} + +enum OraclesOrder { + num_votes + validator_address +} + +type Proxies { + bybit: BybitResponse! +} + +type Query { + communityPool(limit: Int, order_by: CommunityPoolOrder, order_desc: Boolean, where: CommunityPoolFilter): [Token!]! + delegations(limit: Int, order_by: DelegationOrder, order_desc: Boolean, where: DelegationFilter): [Delegation!]! @deprecated(reason: "Moved to staking sub schema") + distributionCommissions(limit: Int, order_by: DistributionCommissionOrder, order_desc: Boolean, where: DistributionCommissionFilter): [DistributionCommission!]! + featureFlags: FeatureFlags! + governance: Governance! + ibc: IBC! + inflation: Inflation! + internal: Internal! + messages(limit: Int, offset: Int, order_by: MessagesOrder, order_desc: Boolean, where: MessagesFilter): [Message!]! + oracle: Oracle! + proxies: Proxies! + redelegations(limit: Int, order_by: RedelegationOrder, order_desc: Boolean, where: RedelegationFilter): [Redelegation!]! @deprecated(reason: "Moved to staking sub schema") + staking: Staking! + stats: Stats! @deprecated(reason: "Will be removed next release") + unbondings(limit: Int, order_by: UnbondingOrder, order_desc: Boolean, where: UnbondingFilter): [Unbonding!]! @deprecated(reason: "Moved to staking sub schema") + user(where: UserFilter!): User + users(limit: Int, order_by: UserOrder, order_desc: Boolean, where: UsersFilter): [User!]! + validators(limit: Int, order_by: ValidatorOrder, order_desc: Boolean, where: ValidatorFilter): [Validator!]! @deprecated(reason: "Moved to staking sub schema") + wasm: Wasm! +} + +type Redelegation { + amount: Int! + completion_time: String! + creation_block: Block! + delegator: User! + destination_validator: Validator! + source_validator: Validator! +} + +input RedelegationFilter { + delegator_address: String + destination_validator_address: String + source_validator_address: String +} + +enum RedelegationOrder { + completion_time + creation_height + delegator_address + destination_validator_address + source_validator_address +} + +type Staking { + delegations(limit: Int, offset: Int, order_by: DelegationOrder, order_desc: Boolean, where: DelegationFilter): [Delegation!]! + history(limit: Int, offset: Int, order_by: StakingHistoryOrder, order_desc: Boolean, where: StakingHistoryFilter): [StakingHistoryItem!]! + redelegations(limit: Int, offset: Int, order_by: RedelegationOrder, order_desc: Boolean, where: RedelegationFilter): [Redelegation!]! + unbondings(limit: Int, offset: Int, order_by: UnbondingOrder, order_desc: Boolean, where: UnbondingFilter): [Unbonding!]! + validators(limit: Int, offset: Int, order_by: ValidatorOrder, order_desc: Boolean, where: ValidatorFilter): [Validator!]! +} + +enum StakingActionType { + cancel + delegate + redelegate + redelegate_completed + unbond + unbond_completed + withdraw +} + +input StakingHistoryFilter { + actions: [StakingActionType!] + amount: IntFilter + block: IntFilter + completionTime: TimeFilter + delegator: StringFilter + validator: StringFilter +} + +type StakingHistoryItem { + action: StakingActionType! + amount: Int! + block: Block! + completion_time: Time + delegator: User! + destination_validator: Validator + validator: Validator! +} + +enum StakingHistoryOrder { + action + amount + delegator + sequence + validator +} + +type Stats { + volume(limit: Int, order: StatsVolumeOrder, orderDesc: Boolean): [StatsVolume!]! +} + +type StatsVolume { + periodStartTs: Time! + volumePerpCumulative: Float! +} + +enum StatsVolumeOrder { + period_start_ts +} + +input StringFilter { + eq: String + like: String +} + +input SubOraclePricesFilter { + pair: String! +} + +type Subscription { + oraclePrices(where: SubOraclePricesFilter): [OraclePrice!]! +} + +scalar Time + +input TimeFilter { + eq: Time + gt: Time + gte: Time + lt: Time + lte: Time +} + +type Token { + amount: String! + denom: String! +} + +type Unbonding { + amount: Int! + completion_time: String! + creation_block: Block! + delegator: User! + validator: Validator! +} + +input UnbondingFilter { + delegator_address: String + validator_address: String +} + +enum UnbondingOrder { + completion_time + creation_height + delegator_address + validator_address +} + +type User { + address: String! + balances: [Token]! + created_block: Block! + is_blocked: Boolean +} + +type UserContract { + contractAddress: String! + contractType: String! + events: [Event!] + user: User! +} + +input UserContractsFilter { + contractAddress: StringFilter + contractType: StringFilter + userAddress: StringFilter +} + +enum UserContractsOrder { + contract_address + contract_type + user_address +} + +input UserFilter { + address: String! +} + +enum UserOrder { + address + created_block +} + +input UsersFilter { + address: String + created_block_eq: Int + created_block_gte: Int + created_block_lte: Int +} + +type Validator { + commission_rates: ValidatorCommission + commission_update_time: String! + creation_block: Block! + delegator_shares: Float! + description: ValidatorDescription! + jailed: Boolean! + min_self_delegation: Int! + operator_address: String! + self_delegation: Int! + status: ValidatorStatus! + tokens: Int! + unbonding_block: Block! + unbonding_time: String! + uptime: Float +} + +type ValidatorCommission { + max_change_rate: Float! + max_rate: Float! + rate: Float! +} + +type ValidatorDescription { + details: String! + identity: String! + moniker: String! + security_contact: String! + website: String! +} + +input ValidatorFilter { + jailed: Boolean + moniker: String + operator_address: String + status: ValidatorStatus +} + +enum ValidatorOrder { + jailed + moniker + operator_address + status + tokens +} + +enum ValidatorStatus { + BONDED + UNBONDED + UNBONDING +} + +type Wasm { + contractEvents(limit: Int, offset: Int, order: ContractEventsOrder, orderDesc: Boolean, where: ContractEventsFilter): [Event!]! + userContracts(limit: Int, offset: Int, order: UserContractsOrder, orderDesc: Boolean, where: UserContractsFilter): [UserContract!]! +} \ No newline at end of file diff --git a/src/protojs/cosmos/auth/v1beta1/auth.ts b/src/protojs/cosmos/auth/v1beta1/auth.ts new file mode 100644 index 00000000..881bd8e2 --- /dev/null +++ b/src/protojs/cosmos/auth/v1beta1/auth.ts @@ -0,0 +1,518 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; + +/** + * 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; + pubKey?: Any; + accountNumber: Long; + sequence: Long; +} + +/** ModuleAccount defines an account for modules that holds coins on a pool. */ +export interface ModuleAccount { + baseAccount?: BaseAccount; + name: string; + permissions: string[]; +} + +/** + * ModuleCredential represents a unclaimable pubkey for base accounts controlled by modules. + * + * Since: cosmos-sdk 0.47 + */ +export interface ModuleCredential { + /** module_name is the name of the module used for address derivation (passed into address.Module). */ + moduleName: string; + /** + * derivation_keys is for deriving a module account address (passed into address.Module) + * adding more keys creates sub-account addresses (passed into address.Derive) + */ + derivationKeys: Uint8Array[]; +} + +/** Params defines the parameters for the auth module. */ +export interface Params { + maxMemoCharacters: Long; + txSigLimit: Long; + txSizeCostPerByte: Long; + sigVerifyCostEd25519: Long; + sigVerifyCostSecp256k1: Long; +} + +function createBaseBaseAccount(): BaseAccount { + return { address: "", pubKey: undefined, accountNumber: Long.UZERO, sequence: Long.UZERO }; +} + +export const BaseAccount = { + encode(message: BaseAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pubKey !== undefined) { + Any.encode(message.pubKey, writer.uint32(18).fork()).ldelim(); + } + if (!message.accountNumber.isZero()) { + writer.uint32(24).uint64(message.accountNumber); + } + if (!message.sequence.isZero()) { + writer.uint32(32).uint64(message.sequence); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BaseAccount { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBaseAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pubKey = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.accountNumber = reader.uint64() as Long; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.sequence = reader.uint64() as Long; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): BaseAccount { + return { + address: isSet(object.address) ? String(object.address) : "", + pubKey: isSet(object.pubKey) ? Any.fromJSON(object.pubKey) : undefined, + accountNumber: isSet(object.accountNumber) ? Long.fromValue(object.accountNumber) : Long.UZERO, + sequence: isSet(object.sequence) ? Long.fromValue(object.sequence) : Long.UZERO, + }; + }, + + toJSON(message: BaseAccount): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.pubKey !== undefined && (obj.pubKey = message.pubKey ? Any.toJSON(message.pubKey) : undefined); + message.accountNumber !== undefined && (obj.accountNumber = (message.accountNumber || Long.UZERO).toString()); + message.sequence !== undefined && (obj.sequence = (message.sequence || Long.UZERO).toString()); + return obj; + }, + + create, I>>(base?: I): BaseAccount { + return BaseAccount.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): BaseAccount { + const message = createBaseBaseAccount(); + message.address = object.address ?? ""; + message.pubKey = (object.pubKey !== undefined && object.pubKey !== null) + ? Any.fromPartial(object.pubKey) + : undefined; + message.accountNumber = (object.accountNumber !== undefined && object.accountNumber !== null) + ? Long.fromValue(object.accountNumber) + : Long.UZERO; + message.sequence = (object.sequence !== undefined && object.sequence !== null) + ? Long.fromValue(object.sequence) + : Long.UZERO; + return message; + }, +}; + +function createBaseModuleAccount(): ModuleAccount { + return { baseAccount: undefined, name: "", permissions: [] }; +} + +export const ModuleAccount = { + encode(message: ModuleAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.baseAccount !== undefined) { + BaseAccount.encode(message.baseAccount, 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: _m0.Reader | Uint8Array, length?: number): ModuleAccount { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.baseAccount = BaseAccount.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.name = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.permissions.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleAccount { + return { + baseAccount: isSet(object.baseAccount) ? BaseAccount.fromJSON(object.baseAccount) : undefined, + name: isSet(object.name) ? String(object.name) : "", + permissions: Array.isArray(object?.permissions) ? object.permissions.map((e: any) => String(e)) : [], + }; + }, + + toJSON(message: ModuleAccount): unknown { + const obj: any = {}; + message.baseAccount !== undefined && + (obj.baseAccount = message.baseAccount ? BaseAccount.toJSON(message.baseAccount) : undefined); + message.name !== undefined && (obj.name = message.name); + if (message.permissions) { + obj.permissions = message.permissions.map((e) => e); + } else { + obj.permissions = []; + } + return obj; + }, + + create, I>>(base?: I): ModuleAccount { + return ModuleAccount.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): ModuleAccount { + const message = createBaseModuleAccount(); + message.baseAccount = (object.baseAccount !== undefined && object.baseAccount !== null) + ? BaseAccount.fromPartial(object.baseAccount) + : undefined; + message.name = object.name ?? ""; + message.permissions = object.permissions?.map((e) => e) || []; + return message; + }, +}; + +function createBaseModuleCredential(): ModuleCredential { + return { moduleName: "", derivationKeys: [] }; +} + +export const ModuleCredential = { + encode(message: ModuleCredential, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.moduleName !== "") { + writer.uint32(10).string(message.moduleName); + } + for (const v of message.derivationKeys) { + writer.uint32(18).bytes(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ModuleCredential { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleCredential(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.moduleName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.derivationKeys.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleCredential { + return { + moduleName: isSet(object.moduleName) ? String(object.moduleName) : "", + derivationKeys: Array.isArray(object?.derivationKeys) + ? object.derivationKeys.map((e: any) => bytesFromBase64(e)) + : [], + }; + }, + + toJSON(message: ModuleCredential): unknown { + const obj: any = {}; + message.moduleName !== undefined && (obj.moduleName = message.moduleName); + if (message.derivationKeys) { + obj.derivationKeys = message.derivationKeys.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array(0))); + } else { + obj.derivationKeys = []; + } + return obj; + }, + + create, I>>(base?: I): ModuleCredential { + return ModuleCredential.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): ModuleCredential { + const message = createBaseModuleCredential(); + message.moduleName = object.moduleName ?? ""; + message.derivationKeys = object.derivationKeys?.map((e) => e) || []; + return message; + }, +}; + +function createBaseParams(): Params { + return { + maxMemoCharacters: Long.UZERO, + txSigLimit: Long.UZERO, + txSizeCostPerByte: Long.UZERO, + sigVerifyCostEd25519: Long.UZERO, + sigVerifyCostSecp256k1: Long.UZERO, + }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (!message.maxMemoCharacters.isZero()) { + writer.uint32(8).uint64(message.maxMemoCharacters); + } + if (!message.txSigLimit.isZero()) { + writer.uint32(16).uint64(message.txSigLimit); + } + if (!message.txSizeCostPerByte.isZero()) { + writer.uint32(24).uint64(message.txSizeCostPerByte); + } + if (!message.sigVerifyCostEd25519.isZero()) { + writer.uint32(32).uint64(message.sigVerifyCostEd25519); + } + if (!message.sigVerifyCostSecp256k1.isZero()) { + writer.uint32(40).uint64(message.sigVerifyCostSecp256k1); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.maxMemoCharacters = reader.uint64() as Long; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.txSigLimit = reader.uint64() as Long; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.txSizeCostPerByte = reader.uint64() as Long; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.sigVerifyCostEd25519 = reader.uint64() as Long; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.sigVerifyCostSecp256k1 = reader.uint64() as Long; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + maxMemoCharacters: isSet(object.maxMemoCharacters) ? Long.fromValue(object.maxMemoCharacters) : Long.UZERO, + txSigLimit: isSet(object.txSigLimit) ? Long.fromValue(object.txSigLimit) : Long.UZERO, + txSizeCostPerByte: isSet(object.txSizeCostPerByte) ? Long.fromValue(object.txSizeCostPerByte) : Long.UZERO, + sigVerifyCostEd25519: isSet(object.sigVerifyCostEd25519) + ? Long.fromValue(object.sigVerifyCostEd25519) + : Long.UZERO, + sigVerifyCostSecp256k1: isSet(object.sigVerifyCostSecp256k1) + ? Long.fromValue(object.sigVerifyCostSecp256k1) + : Long.UZERO, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + message.maxMemoCharacters !== undefined && + (obj.maxMemoCharacters = (message.maxMemoCharacters || Long.UZERO).toString()); + message.txSigLimit !== undefined && (obj.txSigLimit = (message.txSigLimit || Long.UZERO).toString()); + message.txSizeCostPerByte !== undefined && + (obj.txSizeCostPerByte = (message.txSizeCostPerByte || Long.UZERO).toString()); + message.sigVerifyCostEd25519 !== undefined && + (obj.sigVerifyCostEd25519 = (message.sigVerifyCostEd25519 || Long.UZERO).toString()); + message.sigVerifyCostSecp256k1 !== undefined && + (obj.sigVerifyCostSecp256k1 = (message.sigVerifyCostSecp256k1 || Long.UZERO).toString()); + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.maxMemoCharacters = (object.maxMemoCharacters !== undefined && object.maxMemoCharacters !== null) + ? Long.fromValue(object.maxMemoCharacters) + : Long.UZERO; + message.txSigLimit = (object.txSigLimit !== undefined && object.txSigLimit !== null) + ? Long.fromValue(object.txSigLimit) + : Long.UZERO; + message.txSizeCostPerByte = (object.txSizeCostPerByte !== undefined && object.txSizeCostPerByte !== null) + ? Long.fromValue(object.txSizeCostPerByte) + : Long.UZERO; + message.sigVerifyCostEd25519 = (object.sigVerifyCostEd25519 !== undefined && object.sigVerifyCostEd25519 !== null) + ? Long.fromValue(object.sigVerifyCostEd25519) + : Long.UZERO; + message.sigVerifyCostSecp256k1 = + (object.sigVerifyCostSecp256k1 !== undefined && object.sigVerifyCostSecp256k1 !== null) + ? Long.fromValue(object.sigVerifyCostSecp256k1) + : Long.UZERO; + return message; + }, +}; + +declare var self: any | undefined; +declare var window: any | undefined; +declare var global: any | undefined; +var tsProtoGlobalThis: 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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (tsProtoGlobalThis.Buffer) { + return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + } else { + const bin = tsProtoGlobalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (tsProtoGlobalThis.Buffer) { + return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return tsProtoGlobalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/cosmos/bank/v1beta1/bank.ts b/src/protojs/cosmos/bank/v1beta1/bank.ts new file mode 100644 index 00000000..37af7aca --- /dev/null +++ b/src/protojs/cosmos/bank/v1beta1/bank.ts @@ -0,0 +1,733 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; + +/** Params defines the parameters for the bank module. */ +export interface Params { + /** + * Deprecated: Use of SendEnabled in params is deprecated. + * For genesis, use the newly added send_enabled field in the genesis object. + * Storage, lookup, and manipulation of this information is now in the keeper. + * + * As of cosmos-sdk 0.47, this only exists for backwards compatibility of genesis files. + * + * @deprecated + */ + sendEnabled: SendEnabled[]; + defaultSendEnabled: 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 = 10^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 */ + denomUnits: 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; + /** + * URI to a document (on or off-chain) that contains additional information. Optional. + * + * Since: cosmos-sdk 0.46 + */ + uri: string; + /** + * URIHash is a sha256 hash of a document pointed by URI. It's used to verify that + * the document didn't change. Optional. + * + * Since: cosmos-sdk 0.46 + */ + uriHash: string; +} + +function createBaseParams(): Params { + return { sendEnabled: [], defaultSendEnabled: false }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.sendEnabled) { + SendEnabled.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.defaultSendEnabled === true) { + writer.uint32(16).bool(message.defaultSendEnabled); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sendEnabled.push(SendEnabled.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.defaultSendEnabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + sendEnabled: Array.isArray(object?.sendEnabled) + ? object.sendEnabled.map((e: any) => SendEnabled.fromJSON(e)) + : [], + defaultSendEnabled: isSet(object.defaultSendEnabled) ? Boolean(object.defaultSendEnabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.sendEnabled) { + obj.sendEnabled = message.sendEnabled.map((e) => e ? SendEnabled.toJSON(e) : undefined); + } else { + obj.sendEnabled = []; + } + message.defaultSendEnabled !== undefined && (obj.defaultSendEnabled = message.defaultSendEnabled); + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.sendEnabled = object.sendEnabled?.map((e) => SendEnabled.fromPartial(e)) || []; + message.defaultSendEnabled = object.defaultSendEnabled ?? false; + return message; + }, +}; + +function createBaseSendEnabled(): SendEnabled { + return { denom: "", enabled: false }; +} + +export const SendEnabled = { + encode(message: SendEnabled, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.enabled === true) { + writer.uint32(16).bool(message.enabled); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SendEnabled { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSendEnabled(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): SendEnabled { + return { + denom: isSet(object.denom) ? String(object.denom) : "", + enabled: isSet(object.enabled) ? Boolean(object.enabled) : false, + }; + }, + + toJSON(message: SendEnabled): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom); + message.enabled !== undefined && (obj.enabled = message.enabled); + return obj; + }, + + create, I>>(base?: I): SendEnabled { + return SendEnabled.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): SendEnabled { + const message = createBaseSendEnabled(); + message.denom = object.denom ?? ""; + message.enabled = object.enabled ?? false; + return message; + }, +}; + +function createBaseInput(): Input { + return { address: "", coins: [] }; +} + +export const Input = { + encode(message: Input, writer: _m0.Writer = _m0.Writer.create()): _m0.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: _m0.Reader | Uint8Array, length?: number): Input { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInput(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.coins.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Input { + return { + address: isSet(object.address) ? String(object.address) : "", + coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + 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; + }, + + create, I>>(base?: I): Input { + return Input.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): Input { + const message = createBaseInput(); + message.address = object.address ?? ""; + message.coins = object.coins?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseOutput(): Output { + return { address: "", coins: [] }; +} + +export const Output = { + encode(message: Output, writer: _m0.Writer = _m0.Writer.create()): _m0.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: _m0.Reader | Uint8Array, length?: number): Output { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOutput(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.coins.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Output { + return { + address: isSet(object.address) ? String(object.address) : "", + coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + 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; + }, + + create, I>>(base?: I): Output { + return Output.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): Output { + const message = createBaseOutput(); + message.address = object.address ?? ""; + message.coins = object.coins?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSupply(): Supply { + return { total: [] }; +} + +export const Supply = { + encode(message: Supply, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.total) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Supply { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSupply(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.total.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Supply { + return { total: Array.isArray(object?.total) ? object.total.map((e: any) => Coin.fromJSON(e)) : [] }; + }, + + 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; + }, + + create, I>>(base?: I): Supply { + return Supply.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): Supply { + const message = createBaseSupply(); + message.total = object.total?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseDenomUnit(): DenomUnit { + return { denom: "", exponent: 0, aliases: [] }; +} + +export const DenomUnit = { + encode(message: DenomUnit, writer: _m0.Writer = _m0.Writer.create()): _m0.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: _m0.Reader | Uint8Array, length?: number): DenomUnit { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDenomUnit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.exponent = reader.uint32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.aliases.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DenomUnit { + return { + denom: isSet(object.denom) ? String(object.denom) : "", + exponent: isSet(object.exponent) ? Number(object.exponent) : 0, + aliases: Array.isArray(object?.aliases) ? object.aliases.map((e: any) => String(e)) : [], + }; + }, + + toJSON(message: DenomUnit): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom); + message.exponent !== undefined && (obj.exponent = Math.round(message.exponent)); + if (message.aliases) { + obj.aliases = message.aliases.map((e) => e); + } else { + obj.aliases = []; + } + return obj; + }, + + create, I>>(base?: I): DenomUnit { + return DenomUnit.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): DenomUnit { + const message = createBaseDenomUnit(); + message.denom = object.denom ?? ""; + message.exponent = object.exponent ?? 0; + message.aliases = object.aliases?.map((e) => e) || []; + return message; + }, +}; + +function createBaseMetadata(): Metadata { + return { description: "", denomUnits: [], base: "", display: "", name: "", symbol: "", uri: "", uriHash: "" }; +} + +export const Metadata = { + encode(message: Metadata, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.description !== "") { + writer.uint32(10).string(message.description); + } + for (const v of message.denomUnits) { + 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); + } + if (message.uri !== "") { + writer.uint32(58).string(message.uri); + } + if (message.uriHash !== "") { + writer.uint32(66).string(message.uriHash); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Metadata { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.description = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.denomUnits.push(DenomUnit.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.base = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.display = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.name = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.symbol = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.uri = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.uriHash = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Metadata { + return { + description: isSet(object.description) ? String(object.description) : "", + denomUnits: Array.isArray(object?.denomUnits) ? object.denomUnits.map((e: any) => DenomUnit.fromJSON(e)) : [], + base: isSet(object.base) ? String(object.base) : "", + display: isSet(object.display) ? String(object.display) : "", + name: isSet(object.name) ? String(object.name) : "", + symbol: isSet(object.symbol) ? String(object.symbol) : "", + uri: isSet(object.uri) ? String(object.uri) : "", + uriHash: isSet(object.uriHash) ? String(object.uriHash) : "", + }; + }, + + toJSON(message: Metadata): unknown { + const obj: any = {}; + message.description !== undefined && (obj.description = message.description); + if (message.denomUnits) { + obj.denomUnits = message.denomUnits.map((e) => e ? DenomUnit.toJSON(e) : undefined); + } else { + obj.denomUnits = []; + } + 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); + message.uri !== undefined && (obj.uri = message.uri); + message.uriHash !== undefined && (obj.uriHash = message.uriHash); + return obj; + }, + + create, I>>(base?: I): Metadata { + return Metadata.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): Metadata { + const message = createBaseMetadata(); + message.description = object.description ?? ""; + message.denomUnits = object.denomUnits?.map((e) => DenomUnit.fromPartial(e)) || []; + message.base = object.base ?? ""; + message.display = object.display ?? ""; + message.name = object.name ?? ""; + message.symbol = object.symbol ?? ""; + message.uri = object.uri ?? ""; + message.uriHash = object.uriHash ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/cosmos/base/query/v1beta1/pagination.ts b/src/protojs/cosmos/base/query/v1beta1/pagination.ts new file mode 100644 index 00000000..6e50824b --- /dev/null +++ b/src/protojs/cosmos/base/query/v1beta1/pagination.ts @@ -0,0 +1,318 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +/** + * 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: Long; + /** + * 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: Long; + /** + * 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. + */ + countTotal: 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. It will be empty if + * there are no more results. + */ + nextKey: Uint8Array; + /** + * total is total number of results available if PageRequest.count_total + * was set, its value is undefined otherwise + */ + total: Long; +} + +function createBasePageRequest(): PageRequest { + return { key: new Uint8Array(0), offset: Long.UZERO, limit: Long.UZERO, countTotal: false, reverse: false }; +} + +export const PageRequest = { + encode(message: PageRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (!message.offset.isZero()) { + writer.uint32(16).uint64(message.offset); + } + if (!message.limit.isZero()) { + writer.uint32(24).uint64(message.limit); + } + if (message.countTotal === true) { + writer.uint32(32).bool(message.countTotal); + } + if (message.reverse === true) { + writer.uint32(40).bool(message.reverse); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePageRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.offset = reader.uint64() as Long; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.limit = reader.uint64() as Long; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.countTotal = reader.bool(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reverse = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): PageRequest { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + offset: isSet(object.offset) ? Long.fromValue(object.offset) : Long.UZERO, + limit: isSet(object.limit) ? Long.fromValue(object.limit) : Long.UZERO, + countTotal: isSet(object.countTotal) ? Boolean(object.countTotal) : false, + reverse: isSet(object.reverse) ? Boolean(object.reverse) : false, + }; + }, + + toJSON(message: PageRequest): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array(0))); + message.offset !== undefined && (obj.offset = (message.offset || Long.UZERO).toString()); + message.limit !== undefined && (obj.limit = (message.limit || Long.UZERO).toString()); + message.countTotal !== undefined && (obj.countTotal = message.countTotal); + message.reverse !== undefined && (obj.reverse = message.reverse); + return obj; + }, + + create, I>>(base?: I): PageRequest { + return PageRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): PageRequest { + const message = createBasePageRequest(); + message.key = object.key ?? new Uint8Array(0); + message.offset = (object.offset !== undefined && object.offset !== null) + ? Long.fromValue(object.offset) + : Long.UZERO; + message.limit = (object.limit !== undefined && object.limit !== null) ? Long.fromValue(object.limit) : Long.UZERO; + message.countTotal = object.countTotal ?? false; + message.reverse = object.reverse ?? false; + return message; + }, +}; + +function createBasePageResponse(): PageResponse { + return { nextKey: new Uint8Array(0), total: Long.UZERO }; +} + +export const PageResponse = { + encode(message: PageResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.nextKey.length !== 0) { + writer.uint32(10).bytes(message.nextKey); + } + if (!message.total.isZero()) { + writer.uint32(16).uint64(message.total); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePageResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.nextKey = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.total = reader.uint64() as Long; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): PageResponse { + return { + nextKey: isSet(object.nextKey) ? bytesFromBase64(object.nextKey) : new Uint8Array(0), + total: isSet(object.total) ? Long.fromValue(object.total) : Long.UZERO, + }; + }, + + toJSON(message: PageResponse): unknown { + const obj: any = {}; + message.nextKey !== undefined && + (obj.nextKey = base64FromBytes(message.nextKey !== undefined ? message.nextKey : new Uint8Array(0))); + message.total !== undefined && (obj.total = (message.total || Long.UZERO).toString()); + return obj; + }, + + create, I>>(base?: I): PageResponse { + return PageResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): PageResponse { + const message = createBasePageResponse(); + message.nextKey = object.nextKey ?? new Uint8Array(0); + message.total = (object.total !== undefined && object.total !== null) ? Long.fromValue(object.total) : Long.UZERO; + return message; + }, +}; + +declare var self: any | undefined; +declare var window: any | undefined; +declare var global: any | undefined; +var tsProtoGlobalThis: 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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (tsProtoGlobalThis.Buffer) { + return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + } else { + const bin = tsProtoGlobalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (tsProtoGlobalThis.Buffer) { + return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return tsProtoGlobalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/cosmos/base/v1beta1/coin.ts b/src/protojs/cosmos/base/v1beta1/coin.ts new file mode 100644 index 00000000..ab1e3774 --- /dev/null +++ b/src/protojs/cosmos/base/v1beta1/coin.ts @@ -0,0 +1,310 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +/** + * 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; +} + +function createBaseCoin(): Coin { + return { denom: "", amount: "" }; +} + +export const Coin = { + encode(message: Coin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Coin { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Coin { + return { + denom: isSet(object.denom) ? String(object.denom) : "", + amount: isSet(object.amount) ? String(object.amount) : "", + }; + }, + + toJSON(message: Coin): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + create, I>>(base?: I): Coin { + return Coin.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): Coin { + const message = createBaseCoin(); + message.denom = object.denom ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +function createBaseDecCoin(): DecCoin { + return { denom: "", amount: "" }; +} + +export const DecCoin = { + encode(message: DecCoin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DecCoin { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecCoin { + return { + denom: isSet(object.denom) ? String(object.denom) : "", + amount: isSet(object.amount) ? String(object.amount) : "", + }; + }, + + toJSON(message: DecCoin): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + create, I>>(base?: I): DecCoin { + return DecCoin.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): DecCoin { + const message = createBaseDecCoin(); + message.denom = object.denom ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +function createBaseIntProto(): IntProto { + return { int: "" }; +} + +export const IntProto = { + encode(message: IntProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.int !== "") { + writer.uint32(10).string(message.int); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): IntProto { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIntProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.int = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): IntProto { + return { int: isSet(object.int) ? String(object.int) : "" }; + }, + + toJSON(message: IntProto): unknown { + const obj: any = {}; + message.int !== undefined && (obj.int = message.int); + return obj; + }, + + create, I>>(base?: I): IntProto { + return IntProto.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): IntProto { + const message = createBaseIntProto(); + message.int = object.int ?? ""; + return message; + }, +}; + +function createBaseDecProto(): DecProto { + return { dec: "" }; +} + +export const DecProto = { + encode(message: DecProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.dec !== "") { + writer.uint32(10).string(message.dec); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DecProto { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.dec = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecProto { + return { dec: isSet(object.dec) ? String(object.dec) : "" }; + }, + + toJSON(message: DecProto): unknown { + const obj: any = {}; + message.dec !== undefined && (obj.dec = message.dec); + return obj; + }, + + create, I>>(base?: I): DecProto { + return DecProto.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): DecProto { + const message = createBaseDecProto(); + message.dec = object.dec ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/cosmos_proto/cosmos.ts b/src/protojs/cosmos_proto/cosmos.ts new file mode 100644 index 00000000..7e22d9f1 --- /dev/null +++ b/src/protojs/cosmos_proto/cosmos.ts @@ -0,0 +1,285 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export enum ScalarType { + SCALAR_TYPE_UNSPECIFIED = 0, + SCALAR_TYPE_STRING = 1, + SCALAR_TYPE_BYTES = 2, + UNRECOGNIZED = -1, +} + +export function scalarTypeFromJSON(object: any): ScalarType { + switch (object) { + case 0: + case "SCALAR_TYPE_UNSPECIFIED": + return ScalarType.SCALAR_TYPE_UNSPECIFIED; + case 1: + case "SCALAR_TYPE_STRING": + return ScalarType.SCALAR_TYPE_STRING; + case 2: + case "SCALAR_TYPE_BYTES": + return ScalarType.SCALAR_TYPE_BYTES; + case -1: + case "UNRECOGNIZED": + default: + return ScalarType.UNRECOGNIZED; + } +} + +export function scalarTypeToJSON(object: ScalarType): string { + switch (object) { + case ScalarType.SCALAR_TYPE_UNSPECIFIED: + return "SCALAR_TYPE_UNSPECIFIED"; + case ScalarType.SCALAR_TYPE_STRING: + return "SCALAR_TYPE_STRING"; + case ScalarType.SCALAR_TYPE_BYTES: + return "SCALAR_TYPE_BYTES"; + case ScalarType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * InterfaceDescriptor describes an interface type to be used with + * accepts_interface and implements_interface and declared by declare_interface. + */ +export interface InterfaceDescriptor { + /** + * name is the name of the interface. It should be a short-name (without + * a period) such that the fully qualified name of the interface will be + * package.name, ex. for the package a.b and interface named C, the + * fully-qualified name will be a.b.C. + */ + name: string; + /** + * description is a human-readable description of the interface and its + * purpose. + */ + description: string; +} + +/** + * ScalarDescriptor describes an scalar type to be used with + * the scalar field option and declared by declare_scalar. + * Scalars extend simple protobuf built-in types with additional + * syntax and semantics, for instance to represent big integers. + * Scalars should ideally define an encoding such that there is only one + * valid syntactical representation for a given semantic meaning, + * i.e. the encoding should be deterministic. + */ +export interface ScalarDescriptor { + /** + * name is the name of the scalar. It should be a short-name (without + * a period) such that the fully qualified name of the scalar will be + * package.name, ex. for the package a.b and scalar named C, the + * fully-qualified name will be a.b.C. + */ + name: string; + /** + * description is a human-readable description of the scalar and its + * encoding format. For instance a big integer or decimal scalar should + * specify precisely the expected encoding format. + */ + description: string; + /** + * field_type is the type of field with which this scalar can be used. + * Scalars can be used with one and only one type of field so that + * encoding standards and simple and clear. Currently only string and + * bytes fields are supported for scalars. + */ + fieldType: ScalarType[]; +} + +function createBaseInterfaceDescriptor(): InterfaceDescriptor { + return { name: "", description: "" }; +} + +export const InterfaceDescriptor = { + encode(message: InterfaceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInterfaceDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): InterfaceDescriptor { + return { + name: isSet(object.name) ? String(object.name) : "", + description: isSet(object.description) ? String(object.description) : "", + }; + }, + + toJSON(message: InterfaceDescriptor): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.description !== undefined && (obj.description = message.description); + return obj; + }, + + create, I>>(base?: I): InterfaceDescriptor { + return InterfaceDescriptor.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): InterfaceDescriptor { + const message = createBaseInterfaceDescriptor(); + message.name = object.name ?? ""; + message.description = object.description ?? ""; + return message; + }, +}; + +function createBaseScalarDescriptor(): ScalarDescriptor { + return { name: "", description: "", fieldType: [] }; +} + +export const ScalarDescriptor = { + encode(message: ScalarDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + writer.uint32(26).fork(); + for (const v of message.fieldType) { + writer.int32(v); + } + writer.ldelim(); + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ScalarDescriptor { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseScalarDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag === 24) { + message.fieldType.push(reader.int32() as any); + + continue; + } + + if (tag === 26) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.fieldType.push(reader.int32() as any); + } + + continue; + } + + break; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ScalarDescriptor { + return { + name: isSet(object.name) ? String(object.name) : "", + description: isSet(object.description) ? String(object.description) : "", + fieldType: Array.isArray(object?.fieldType) ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) : [], + }; + }, + + toJSON(message: ScalarDescriptor): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.description !== undefined && (obj.description = message.description); + if (message.fieldType) { + obj.fieldType = message.fieldType.map((e) => scalarTypeToJSON(e)); + } else { + obj.fieldType = []; + } + return obj; + }, + + create, I>>(base?: I): ScalarDescriptor { + return ScalarDescriptor.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): ScalarDescriptor { + const message = createBaseScalarDescriptor(); + message.name = object.name ?? ""; + message.description = object.description ?? ""; + message.fieldType = object.fieldType?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/eth/evm/v1/events.ts b/src/protojs/eth/evm/v1/events.ts new file mode 100644 index 00000000..2238bc84 --- /dev/null +++ b/src/protojs/eth/evm/v1/events.ts @@ -0,0 +1,766 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../../cosmos/base/v1beta1/coin"; + +/** Copyright (c) 2023-2024 Nibi, Inc. */ + +/** EventEthereumTx defines the event for an Ethereum transaction */ +export interface EventEthereumTx { + /** amount */ + amount: string; + /** eth_hash is the Ethereum hash of the transaction */ + ethHash: string; + /** index of the transaction in the block */ + index: string; + /** gas_used is the amount of gas used by the transaction */ + gasUsed: string; + /** hash is the Tendermint hash of the transaction */ + hash: string; + /** recipient of the transaction */ + recipient: string; + /** eth_tx_failed contains a VM error should it occur */ + ethTxFailed: string; +} + +/** EventTxLog defines the event for an Ethereum transaction log */ +export interface EventTxLog { + /** tx_logs is an array of transaction logs */ + txLogs: string[]; +} + +/** EventBlockBloom defines an Ethereum block bloom filter event */ +export interface EventBlockBloom { + /** bloom is the bloom filter of the block */ + bloom: string; +} + +/** EventFunTokenCreated defines a fun token creation event. */ +export interface EventFunTokenCreated { + bankDenom: string; + erc20ContractAddress: string; + creator: string; + isMadeFromCoin: boolean; +} + +/** ConvertCoinToEvm defines sending fun token to erc20 event. */ +export interface EventConvertCoinToEvm { + sender: string; + erc20ContractAddress: string; + toEthAddr: string; + bankCoin?: Coin; +} + +/** EventTransfer defines event for EVM transfer */ +export interface EventTransfer { + sender: string; + recipient: string; + amount: string; +} + +/** EventContractDeployed defines event for EVM contract deployment */ +export interface EventContractDeployed { + sender: string; + contractAddr: string; +} + +/** EventContractExecuted defines event for EVM contract execution */ +export interface EventContractExecuted { + sender: string; + contractAddr: string; +} + +function createBaseEventEthereumTx(): EventEthereumTx { + return { amount: "", ethHash: "", index: "", gasUsed: "", hash: "", recipient: "", ethTxFailed: "" }; +} + +export const EventEthereumTx = { + encode(message: EventEthereumTx, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.amount !== "") { + writer.uint32(10).string(message.amount); + } + if (message.ethHash !== "") { + writer.uint32(18).string(message.ethHash); + } + if (message.index !== "") { + writer.uint32(26).string(message.index); + } + if (message.gasUsed !== "") { + writer.uint32(34).string(message.gasUsed); + } + if (message.hash !== "") { + writer.uint32(42).string(message.hash); + } + if (message.recipient !== "") { + writer.uint32(50).string(message.recipient); + } + if (message.ethTxFailed !== "") { + writer.uint32(58).string(message.ethTxFailed); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventEthereumTx { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventEthereumTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.amount = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.ethHash = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.index = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.gasUsed = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.hash = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.recipient = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.ethTxFailed = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventEthereumTx { + return { + amount: isSet(object.amount) ? String(object.amount) : "", + ethHash: isSet(object.ethHash) ? String(object.ethHash) : "", + index: isSet(object.index) ? String(object.index) : "", + gasUsed: isSet(object.gasUsed) ? String(object.gasUsed) : "", + hash: isSet(object.hash) ? String(object.hash) : "", + recipient: isSet(object.recipient) ? String(object.recipient) : "", + ethTxFailed: isSet(object.ethTxFailed) ? String(object.ethTxFailed) : "", + }; + }, + + toJSON(message: EventEthereumTx): unknown { + const obj: any = {}; + message.amount !== undefined && (obj.amount = message.amount); + message.ethHash !== undefined && (obj.ethHash = message.ethHash); + message.index !== undefined && (obj.index = message.index); + message.gasUsed !== undefined && (obj.gasUsed = message.gasUsed); + message.hash !== undefined && (obj.hash = message.hash); + message.recipient !== undefined && (obj.recipient = message.recipient); + message.ethTxFailed !== undefined && (obj.ethTxFailed = message.ethTxFailed); + return obj; + }, + + create, I>>(base?: I): EventEthereumTx { + return EventEthereumTx.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): EventEthereumTx { + const message = createBaseEventEthereumTx(); + message.amount = object.amount ?? ""; + message.ethHash = object.ethHash ?? ""; + message.index = object.index ?? ""; + message.gasUsed = object.gasUsed ?? ""; + message.hash = object.hash ?? ""; + message.recipient = object.recipient ?? ""; + message.ethTxFailed = object.ethTxFailed ?? ""; + return message; + }, +}; + +function createBaseEventTxLog(): EventTxLog { + return { txLogs: [] }; +} + +export const EventTxLog = { + encode(message: EventTxLog, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.txLogs) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventTxLog { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventTxLog(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txLogs.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventTxLog { + return { txLogs: Array.isArray(object?.txLogs) ? object.txLogs.map((e: any) => String(e)) : [] }; + }, + + toJSON(message: EventTxLog): unknown { + const obj: any = {}; + if (message.txLogs) { + obj.txLogs = message.txLogs.map((e) => e); + } else { + obj.txLogs = []; + } + return obj; + }, + + create, I>>(base?: I): EventTxLog { + return EventTxLog.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): EventTxLog { + const message = createBaseEventTxLog(); + message.txLogs = object.txLogs?.map((e) => e) || []; + return message; + }, +}; + +function createBaseEventBlockBloom(): EventBlockBloom { + return { bloom: "" }; +} + +export const EventBlockBloom = { + encode(message: EventBlockBloom, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.bloom !== "") { + writer.uint32(10).string(message.bloom); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventBlockBloom { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventBlockBloom(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.bloom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventBlockBloom { + return { bloom: isSet(object.bloom) ? String(object.bloom) : "" }; + }, + + toJSON(message: EventBlockBloom): unknown { + const obj: any = {}; + message.bloom !== undefined && (obj.bloom = message.bloom); + return obj; + }, + + create, I>>(base?: I): EventBlockBloom { + return EventBlockBloom.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): EventBlockBloom { + const message = createBaseEventBlockBloom(); + message.bloom = object.bloom ?? ""; + return message; + }, +}; + +function createBaseEventFunTokenCreated(): EventFunTokenCreated { + return { bankDenom: "", erc20ContractAddress: "", creator: "", isMadeFromCoin: false }; +} + +export const EventFunTokenCreated = { + encode(message: EventFunTokenCreated, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.bankDenom !== "") { + writer.uint32(10).string(message.bankDenom); + } + if (message.erc20ContractAddress !== "") { + writer.uint32(18).string(message.erc20ContractAddress); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + if (message.isMadeFromCoin === true) { + writer.uint32(32).bool(message.isMadeFromCoin); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventFunTokenCreated { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventFunTokenCreated(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.bankDenom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.erc20ContractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.isMadeFromCoin = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventFunTokenCreated { + return { + bankDenom: isSet(object.bankDenom) ? String(object.bankDenom) : "", + erc20ContractAddress: isSet(object.erc20ContractAddress) ? String(object.erc20ContractAddress) : "", + creator: isSet(object.creator) ? String(object.creator) : "", + isMadeFromCoin: isSet(object.isMadeFromCoin) ? Boolean(object.isMadeFromCoin) : false, + }; + }, + + toJSON(message: EventFunTokenCreated): unknown { + const obj: any = {}; + message.bankDenom !== undefined && (obj.bankDenom = message.bankDenom); + message.erc20ContractAddress !== undefined && (obj.erc20ContractAddress = message.erc20ContractAddress); + message.creator !== undefined && (obj.creator = message.creator); + message.isMadeFromCoin !== undefined && (obj.isMadeFromCoin = message.isMadeFromCoin); + return obj; + }, + + create, I>>(base?: I): EventFunTokenCreated { + return EventFunTokenCreated.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): EventFunTokenCreated { + const message = createBaseEventFunTokenCreated(); + message.bankDenom = object.bankDenom ?? ""; + message.erc20ContractAddress = object.erc20ContractAddress ?? ""; + message.creator = object.creator ?? ""; + message.isMadeFromCoin = object.isMadeFromCoin ?? false; + return message; + }, +}; + +function createBaseEventConvertCoinToEvm(): EventConvertCoinToEvm { + return { sender: "", erc20ContractAddress: "", toEthAddr: "", bankCoin: undefined }; +} + +export const EventConvertCoinToEvm = { + encode(message: EventConvertCoinToEvm, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.erc20ContractAddress !== "") { + writer.uint32(18).string(message.erc20ContractAddress); + } + if (message.toEthAddr !== "") { + writer.uint32(26).string(message.toEthAddr); + } + if (message.bankCoin !== undefined) { + Coin.encode(message.bankCoin, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventConvertCoinToEvm { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventConvertCoinToEvm(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sender = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.erc20ContractAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.toEthAddr = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.bankCoin = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventConvertCoinToEvm { + return { + sender: isSet(object.sender) ? String(object.sender) : "", + erc20ContractAddress: isSet(object.erc20ContractAddress) ? String(object.erc20ContractAddress) : "", + toEthAddr: isSet(object.toEthAddr) ? String(object.toEthAddr) : "", + bankCoin: isSet(object.bankCoin) ? Coin.fromJSON(object.bankCoin) : undefined, + }; + }, + + toJSON(message: EventConvertCoinToEvm): unknown { + const obj: any = {}; + message.sender !== undefined && (obj.sender = message.sender); + message.erc20ContractAddress !== undefined && (obj.erc20ContractAddress = message.erc20ContractAddress); + message.toEthAddr !== undefined && (obj.toEthAddr = message.toEthAddr); + message.bankCoin !== undefined && (obj.bankCoin = message.bankCoin ? Coin.toJSON(message.bankCoin) : undefined); + return obj; + }, + + create, I>>(base?: I): EventConvertCoinToEvm { + return EventConvertCoinToEvm.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): EventConvertCoinToEvm { + const message = createBaseEventConvertCoinToEvm(); + message.sender = object.sender ?? ""; + message.erc20ContractAddress = object.erc20ContractAddress ?? ""; + message.toEthAddr = object.toEthAddr ?? ""; + message.bankCoin = (object.bankCoin !== undefined && object.bankCoin !== null) + ? Coin.fromPartial(object.bankCoin) + : undefined; + return message; + }, +}; + +function createBaseEventTransfer(): EventTransfer { + return { sender: "", recipient: "", amount: "" }; +} + +export const EventTransfer = { + encode(message: EventTransfer, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.recipient !== "") { + writer.uint32(18).string(message.recipient); + } + if (message.amount !== "") { + writer.uint32(26).string(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventTransfer { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventTransfer(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sender = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.recipient = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventTransfer { + return { + sender: isSet(object.sender) ? String(object.sender) : "", + recipient: isSet(object.recipient) ? String(object.recipient) : "", + amount: isSet(object.amount) ? String(object.amount) : "", + }; + }, + + toJSON(message: EventTransfer): unknown { + const obj: any = {}; + message.sender !== undefined && (obj.sender = message.sender); + message.recipient !== undefined && (obj.recipient = message.recipient); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + create, I>>(base?: I): EventTransfer { + return EventTransfer.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): EventTransfer { + const message = createBaseEventTransfer(); + message.sender = object.sender ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +function createBaseEventContractDeployed(): EventContractDeployed { + return { sender: "", contractAddr: "" }; +} + +export const EventContractDeployed = { + encode(message: EventContractDeployed, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.contractAddr !== "") { + writer.uint32(18).string(message.contractAddr); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventContractDeployed { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventContractDeployed(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sender = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventContractDeployed { + return { + sender: isSet(object.sender) ? String(object.sender) : "", + contractAddr: isSet(object.contractAddr) ? String(object.contractAddr) : "", + }; + }, + + toJSON(message: EventContractDeployed): unknown { + const obj: any = {}; + message.sender !== undefined && (obj.sender = message.sender); + message.contractAddr !== undefined && (obj.contractAddr = message.contractAddr); + return obj; + }, + + create, I>>(base?: I): EventContractDeployed { + return EventContractDeployed.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): EventContractDeployed { + const message = createBaseEventContractDeployed(); + message.sender = object.sender ?? ""; + message.contractAddr = object.contractAddr ?? ""; + return message; + }, +}; + +function createBaseEventContractExecuted(): EventContractExecuted { + return { sender: "", contractAddr: "" }; +} + +export const EventContractExecuted = { + encode(message: EventContractExecuted, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.contractAddr !== "") { + writer.uint32(18).string(message.contractAddr); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventContractExecuted { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventContractExecuted(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sender = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contractAddr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventContractExecuted { + return { + sender: isSet(object.sender) ? String(object.sender) : "", + contractAddr: isSet(object.contractAddr) ? String(object.contractAddr) : "", + }; + }, + + toJSON(message: EventContractExecuted): unknown { + const obj: any = {}; + message.sender !== undefined && (obj.sender = message.sender); + message.contractAddr !== undefined && (obj.contractAddr = message.contractAddr); + return obj; + }, + + create, I>>(base?: I): EventContractExecuted { + return EventContractExecuted.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): EventContractExecuted { + const message = createBaseEventContractExecuted(); + message.sender = object.sender ?? ""; + message.contractAddr = object.contractAddr ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/eth/evm/v1/evm.ts b/src/protojs/eth/evm/v1/evm.ts new file mode 100644 index 00000000..7bb2ac78 --- /dev/null +++ b/src/protojs/eth/evm/v1/evm.ts @@ -0,0 +1,1188 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +/** Copyright (c) 2023-2024 Nibi, Inc. */ + +/** + * FunToken is a fungible token mapping between a Bank Coin and a corresponding + * ERC-20 smart contract. Bank Coins here refer to tokens like NIBI, IBC + * coins (ICS-20), and token factory coins, which are each represented by the + * "Coin" type in Golang. + */ +export interface FunToken { + /** Hexadecimal address of the ERC20 token to which the `FunToken` maps */ + erc20Addr: string; + /** bank_denom: Coin denomination in the Bank Module. */ + bankDenom: string; + /** + * True if the `FunToken` mapping was created from an existing Bank Coin and + * the ERC-20 contract gets deployed by the module account. False if the + * mapping was created from an externally owned ERC-20 contract. + */ + isMadeFromCoin: boolean; +} + +/** Params defines the EVM module parameters */ +export interface Params { + /** extra_eips defines the additional EIPs for the vm.Config */ + extraEips: Long[]; + /** evm_channels is the list of channel identifiers from EVM compatible chains */ + evmChannels: string[]; + /** + * Fee deducted and burned when calling "CreateFunToken" in units of + * "evm_denom". + */ + createFuntokenFee: string; +} + +/** State represents a single Storage key value pair item. */ +export interface State { + /** key is the stored key */ + key: string; + /** value is the stored value for the given key */ + value: string; +} + +/** + * TransactionLogs define the logs generated from a transaction execution + * with a given hash. It it used for import/export data as transactions are not + * persisted on blockchain state after an upgrade. + */ +export interface TransactionLogs { + /** hash of the transaction */ + hash: string; + /** logs is an array of Logs for the given transaction hash */ + logs: Log[]; +} + +/** + * Log represents an protobuf compatible Ethereum Log that defines a contract + * log event. These events are generated by the LOG opcode and stored/indexed by + * the node. + * + * NOTE: address, topics and data are consensus fields. The rest of the fields + * are derived, i.e. filled in by the nodes, but not secured by consensus. + */ +export interface Log { + /** address of the contract that generated the event */ + address: string; + /** topics is a list of topics provided by the contract. */ + topics: string[]; + /** data which is supplied by the contract, usually ABI-encoded */ + data: Uint8Array; + /** block_number of the block in which the transaction was included */ + blockNumber: Long; + /** tx_hash is the transaction hash */ + txHash: string; + /** tx_index of the transaction in the block */ + txIndex: Long; + /** block_hash of the block in which the transaction was included */ + blockHash: string; + /** index of the log in the block */ + index: Long; + /** + * removed is true if this log was reverted due to a chain + * reorganisation. You must pay attention to this field if you receive logs + * through a filter query. + */ + removed: boolean; +} + +/** TxResult stores results of Tx execution. */ +export interface TxResult { + /** + * contract_address contains the ethereum address of the created contract (if + * any). If the state transition is an evm.Call, the contract address will be + * empty. + */ + contractAddress: string; + /** bloom represents the bloom filter bytes */ + bloom: Uint8Array; + /** + * tx_logs contains the transaction hash and the proto-compatible ethereum + * logs. + */ + txLogs?: TransactionLogs; + /** ret defines the bytes from the execution. */ + ret: Uint8Array; + /** reverted flag is set to true when the call has been reverted */ + reverted: boolean; + /** gas_used notes the amount of gas consumed while execution */ + gasUsed: Long; +} + +/** AccessTuple is the element type of an access list. */ +export interface AccessTuple { + /** address is a hex formatted ethereum address */ + address: string; + /** storage_keys are hex formatted hashes of the storage keys */ + storageKeys: string[]; +} + +/** TracerConfig stores additional tracer args. For geth it's only one attr: onlyTopCall */ +export interface TracerConfig { + onlyTopCall: boolean; +} + +/** TraceConfig holds extra parameters to trace functions. */ +export interface TraceConfig { + /** tracer is a custom javascript tracer */ + tracer: string; + /** + * timeout overrides the default timeout of 5 seconds for JavaScript-based + * tracing calls + */ + timeout: string; + /** reexec defines the number of blocks the tracer is willing to go back */ + reexec: Long; + /** disable_stack switches stack capture */ + disableStack: boolean; + /** disable_storage switches storage capture */ + disableStorage: boolean; + /** debug can be used to print output during capture end */ + debug: boolean; + /** limit defines the maximum length of output, but zero means unlimited */ + limit: number; + /** enable_memory switches memory capture */ + enableMemory: boolean; + /** enable_return_data switches the capture of return data */ + enableReturnData: boolean; + /** tracer_config configures the tracer options */ + tracerConfig?: TracerConfig; +} + +function createBaseFunToken(): FunToken { + return { erc20Addr: "", bankDenom: "", isMadeFromCoin: false }; +} + +export const FunToken = { + encode(message: FunToken, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.erc20Addr !== "") { + writer.uint32(10).string(message.erc20Addr); + } + if (message.bankDenom !== "") { + writer.uint32(18).string(message.bankDenom); + } + if (message.isMadeFromCoin === true) { + writer.uint32(24).bool(message.isMadeFromCoin); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): FunToken { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFunToken(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.erc20Addr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.bankDenom = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.isMadeFromCoin = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): FunToken { + return { + erc20Addr: isSet(object.erc20Addr) ? String(object.erc20Addr) : "", + bankDenom: isSet(object.bankDenom) ? String(object.bankDenom) : "", + isMadeFromCoin: isSet(object.isMadeFromCoin) ? Boolean(object.isMadeFromCoin) : false, + }; + }, + + toJSON(message: FunToken): unknown { + const obj: any = {}; + message.erc20Addr !== undefined && (obj.erc20Addr = message.erc20Addr); + message.bankDenom !== undefined && (obj.bankDenom = message.bankDenom); + message.isMadeFromCoin !== undefined && (obj.isMadeFromCoin = message.isMadeFromCoin); + return obj; + }, + + create, I>>(base?: I): FunToken { + return FunToken.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): FunToken { + const message = createBaseFunToken(); + message.erc20Addr = object.erc20Addr ?? ""; + message.bankDenom = object.bankDenom ?? ""; + message.isMadeFromCoin = object.isMadeFromCoin ?? false; + return message; + }, +}; + +function createBaseParams(): Params { + return { extraEips: [], evmChannels: [], createFuntokenFee: "" }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + writer.uint32(34).fork(); + for (const v of message.extraEips) { + writer.int64(v); + } + writer.ldelim(); + for (const v of message.evmChannels) { + writer.uint32(66).string(v!); + } + if (message.createFuntokenFee !== "") { + writer.uint32(74).string(message.createFuntokenFee); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 4: + if (tag === 32) { + message.extraEips.push(reader.int64() as Long); + + continue; + } + + if (tag === 34) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.extraEips.push(reader.int64() as Long); + } + + continue; + } + + break; + case 8: + if (tag !== 66) { + break; + } + + message.evmChannels.push(reader.string()); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.createFuntokenFee = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + extraEips: Array.isArray(object?.extraEips) ? object.extraEips.map((e: any) => Long.fromValue(e)) : [], + evmChannels: Array.isArray(object?.evmChannels) ? object.evmChannels.map((e: any) => String(e)) : [], + createFuntokenFee: isSet(object.createFuntokenFee) ? String(object.createFuntokenFee) : "", + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.extraEips) { + obj.extraEips = message.extraEips.map((e) => (e || Long.ZERO).toString()); + } else { + obj.extraEips = []; + } + if (message.evmChannels) { + obj.evmChannels = message.evmChannels.map((e) => e); + } else { + obj.evmChannels = []; + } + message.createFuntokenFee !== undefined && (obj.createFuntokenFee = message.createFuntokenFee); + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.extraEips = object.extraEips?.map((e) => Long.fromValue(e)) || []; + message.evmChannels = object.evmChannels?.map((e) => e) || []; + message.createFuntokenFee = object.createFuntokenFee ?? ""; + return message; + }, +}; + +function createBaseState(): State { + return { key: "", value: "" }; +} + +export const State = { + encode(message: State, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): State { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): State { + return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object.value) ? String(object.value) : "" }; + }, + + toJSON(message: State): unknown { + const obj: any = {}; + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && (obj.value = message.value); + return obj; + }, + + create, I>>(base?: I): State { + return State.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): State { + const message = createBaseState(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +function createBaseTransactionLogs(): TransactionLogs { + return { hash: "", logs: [] }; +} + +export const TransactionLogs = { + encode(message: TransactionLogs, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.hash !== "") { + writer.uint32(10).string(message.hash); + } + for (const v of message.logs) { + Log.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TransactionLogs { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTransactionLogs(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.hash = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.logs.push(Log.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): TransactionLogs { + return { + hash: isSet(object.hash) ? String(object.hash) : "", + logs: Array.isArray(object?.logs) ? object.logs.map((e: any) => Log.fromJSON(e)) : [], + }; + }, + + toJSON(message: TransactionLogs): unknown { + const obj: any = {}; + message.hash !== undefined && (obj.hash = message.hash); + if (message.logs) { + obj.logs = message.logs.map((e) => e ? Log.toJSON(e) : undefined); + } else { + obj.logs = []; + } + return obj; + }, + + create, I>>(base?: I): TransactionLogs { + return TransactionLogs.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): TransactionLogs { + const message = createBaseTransactionLogs(); + message.hash = object.hash ?? ""; + message.logs = object.logs?.map((e) => Log.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseLog(): Log { + return { + address: "", + topics: [], + data: new Uint8Array(0), + blockNumber: Long.UZERO, + txHash: "", + txIndex: Long.UZERO, + blockHash: "", + index: Long.UZERO, + removed: false, + }; +} + +export const Log = { + encode(message: Log, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + for (const v of message.topics) { + writer.uint32(18).string(v!); + } + if (message.data.length !== 0) { + writer.uint32(26).bytes(message.data); + } + if (!message.blockNumber.isZero()) { + writer.uint32(32).uint64(message.blockNumber); + } + if (message.txHash !== "") { + writer.uint32(42).string(message.txHash); + } + if (!message.txIndex.isZero()) { + writer.uint32(48).uint64(message.txIndex); + } + if (message.blockHash !== "") { + writer.uint32(58).string(message.blockHash); + } + if (!message.index.isZero()) { + writer.uint32(64).uint64(message.index); + } + if (message.removed === true) { + writer.uint32(72).bool(message.removed); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Log { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLog(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.topics.push(reader.string()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.bytes(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.blockNumber = reader.uint64() as Long; + continue; + case 5: + if (tag !== 42) { + break; + } + + message.txHash = reader.string(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.txIndex = reader.uint64() as Long; + continue; + case 7: + if (tag !== 58) { + break; + } + + message.blockHash = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.index = reader.uint64() as Long; + continue; + case 9: + if (tag !== 72) { + break; + } + + message.removed = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Log { + return { + address: isSet(object.address) ? String(object.address) : "", + topics: Array.isArray(object?.topics) ? object.topics.map((e: any) => String(e)) : [], + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + blockNumber: isSet(object.blockNumber) ? Long.fromValue(object.blockNumber) : Long.UZERO, + txHash: isSet(object.txHash) ? String(object.txHash) : "", + txIndex: isSet(object.txIndex) ? Long.fromValue(object.txIndex) : Long.UZERO, + blockHash: isSet(object.blockHash) ? String(object.blockHash) : "", + index: isSet(object.index) ? Long.fromValue(object.index) : Long.UZERO, + removed: isSet(object.removed) ? Boolean(object.removed) : false, + }; + }, + + toJSON(message: Log): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + if (message.topics) { + obj.topics = message.topics.map((e) => e); + } else { + obj.topics = []; + } + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array(0))); + message.blockNumber !== undefined && (obj.blockNumber = (message.blockNumber || Long.UZERO).toString()); + message.txHash !== undefined && (obj.txHash = message.txHash); + message.txIndex !== undefined && (obj.txIndex = (message.txIndex || Long.UZERO).toString()); + message.blockHash !== undefined && (obj.blockHash = message.blockHash); + message.index !== undefined && (obj.index = (message.index || Long.UZERO).toString()); + message.removed !== undefined && (obj.removed = message.removed); + return obj; + }, + + create, I>>(base?: I): Log { + return Log.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): Log { + const message = createBaseLog(); + message.address = object.address ?? ""; + message.topics = object.topics?.map((e) => e) || []; + message.data = object.data ?? new Uint8Array(0); + message.blockNumber = (object.blockNumber !== undefined && object.blockNumber !== null) + ? Long.fromValue(object.blockNumber) + : Long.UZERO; + message.txHash = object.txHash ?? ""; + message.txIndex = (object.txIndex !== undefined && object.txIndex !== null) + ? Long.fromValue(object.txIndex) + : Long.UZERO; + message.blockHash = object.blockHash ?? ""; + message.index = (object.index !== undefined && object.index !== null) ? Long.fromValue(object.index) : Long.UZERO; + message.removed = object.removed ?? false; + return message; + }, +}; + +function createBaseTxResult(): TxResult { + return { + contractAddress: "", + bloom: new Uint8Array(0), + txLogs: undefined, + ret: new Uint8Array(0), + reverted: false, + gasUsed: Long.UZERO, + }; +} + +export const TxResult = { + encode(message: TxResult, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.contractAddress !== "") { + writer.uint32(10).string(message.contractAddress); + } + if (message.bloom.length !== 0) { + writer.uint32(18).bytes(message.bloom); + } + if (message.txLogs !== undefined) { + TransactionLogs.encode(message.txLogs, writer.uint32(26).fork()).ldelim(); + } + if (message.ret.length !== 0) { + writer.uint32(34).bytes(message.ret); + } + if (message.reverted === true) { + writer.uint32(40).bool(message.reverted); + } + if (!message.gasUsed.isZero()) { + writer.uint32(48).uint64(message.gasUsed); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TxResult { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.bloom = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.txLogs = TransactionLogs.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.ret = reader.bytes(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reverted = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.gasUsed = reader.uint64() as Long; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxResult { + return { + contractAddress: isSet(object.contractAddress) ? String(object.contractAddress) : "", + bloom: isSet(object.bloom) ? bytesFromBase64(object.bloom) : new Uint8Array(0), + txLogs: isSet(object.txLogs) ? TransactionLogs.fromJSON(object.txLogs) : undefined, + ret: isSet(object.ret) ? bytesFromBase64(object.ret) : new Uint8Array(0), + reverted: isSet(object.reverted) ? Boolean(object.reverted) : false, + gasUsed: isSet(object.gasUsed) ? Long.fromValue(object.gasUsed) : Long.UZERO, + }; + }, + + toJSON(message: TxResult): unknown { + const obj: any = {}; + message.contractAddress !== undefined && (obj.contractAddress = message.contractAddress); + message.bloom !== undefined && + (obj.bloom = base64FromBytes(message.bloom !== undefined ? message.bloom : new Uint8Array(0))); + message.txLogs !== undefined && (obj.txLogs = message.txLogs ? TransactionLogs.toJSON(message.txLogs) : undefined); + message.ret !== undefined && + (obj.ret = base64FromBytes(message.ret !== undefined ? message.ret : new Uint8Array(0))); + message.reverted !== undefined && (obj.reverted = message.reverted); + message.gasUsed !== undefined && (obj.gasUsed = (message.gasUsed || Long.UZERO).toString()); + return obj; + }, + + create, I>>(base?: I): TxResult { + return TxResult.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): TxResult { + const message = createBaseTxResult(); + message.contractAddress = object.contractAddress ?? ""; + message.bloom = object.bloom ?? new Uint8Array(0); + message.txLogs = (object.txLogs !== undefined && object.txLogs !== null) + ? TransactionLogs.fromPartial(object.txLogs) + : undefined; + message.ret = object.ret ?? new Uint8Array(0); + message.reverted = object.reverted ?? false; + message.gasUsed = (object.gasUsed !== undefined && object.gasUsed !== null) + ? Long.fromValue(object.gasUsed) + : Long.UZERO; + return message; + }, +}; + +function createBaseAccessTuple(): AccessTuple { + return { address: "", storageKeys: [] }; +} + +export const AccessTuple = { + encode(message: AccessTuple, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + for (const v of message.storageKeys) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AccessTuple { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAccessTuple(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.storageKeys.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): AccessTuple { + return { + address: isSet(object.address) ? String(object.address) : "", + storageKeys: Array.isArray(object?.storageKeys) ? object.storageKeys.map((e: any) => String(e)) : [], + }; + }, + + toJSON(message: AccessTuple): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + if (message.storageKeys) { + obj.storageKeys = message.storageKeys.map((e) => e); + } else { + obj.storageKeys = []; + } + return obj; + }, + + create, I>>(base?: I): AccessTuple { + return AccessTuple.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): AccessTuple { + const message = createBaseAccessTuple(); + message.address = object.address ?? ""; + message.storageKeys = object.storageKeys?.map((e) => e) || []; + return message; + }, +}; + +function createBaseTracerConfig(): TracerConfig { + return { onlyTopCall: false }; +} + +export const TracerConfig = { + encode(message: TracerConfig, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.onlyTopCall === true) { + writer.uint32(8).bool(message.onlyTopCall); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TracerConfig { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTracerConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.onlyTopCall = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): TracerConfig { + return { onlyTopCall: isSet(object.onlyTopCall) ? Boolean(object.onlyTopCall) : false }; + }, + + toJSON(message: TracerConfig): unknown { + const obj: any = {}; + message.onlyTopCall !== undefined && (obj.onlyTopCall = message.onlyTopCall); + return obj; + }, + + create, I>>(base?: I): TracerConfig { + return TracerConfig.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): TracerConfig { + const message = createBaseTracerConfig(); + message.onlyTopCall = object.onlyTopCall ?? false; + return message; + }, +}; + +function createBaseTraceConfig(): TraceConfig { + return { + tracer: "", + timeout: "", + reexec: Long.UZERO, + disableStack: false, + disableStorage: false, + debug: false, + limit: 0, + enableMemory: false, + enableReturnData: false, + tracerConfig: undefined, + }; +} + +export const TraceConfig = { + encode(message: TraceConfig, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.tracer !== "") { + writer.uint32(10).string(message.tracer); + } + if (message.timeout !== "") { + writer.uint32(18).string(message.timeout); + } + if (!message.reexec.isZero()) { + writer.uint32(24).uint64(message.reexec); + } + if (message.disableStack === true) { + writer.uint32(40).bool(message.disableStack); + } + if (message.disableStorage === true) { + writer.uint32(48).bool(message.disableStorage); + } + if (message.debug === true) { + writer.uint32(64).bool(message.debug); + } + if (message.limit !== 0) { + writer.uint32(72).int32(message.limit); + } + if (message.enableMemory === true) { + writer.uint32(88).bool(message.enableMemory); + } + if (message.enableReturnData === true) { + writer.uint32(96).bool(message.enableReturnData); + } + if (message.tracerConfig !== undefined) { + TracerConfig.encode(message.tracerConfig, writer.uint32(106).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TraceConfig { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTraceConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tracer = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.timeout = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.reexec = reader.uint64() as Long; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.disableStack = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.disableStorage = reader.bool(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.debug = reader.bool(); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.limit = reader.int32(); + continue; + case 11: + if (tag !== 88) { + break; + } + + message.enableMemory = reader.bool(); + continue; + case 12: + if (tag !== 96) { + break; + } + + message.enableReturnData = reader.bool(); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.tracerConfig = TracerConfig.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): TraceConfig { + return { + tracer: isSet(object.tracer) ? String(object.tracer) : "", + timeout: isSet(object.timeout) ? String(object.timeout) : "", + reexec: isSet(object.reexec) ? Long.fromValue(object.reexec) : Long.UZERO, + disableStack: isSet(object.disableStack) ? Boolean(object.disableStack) : false, + disableStorage: isSet(object.disableStorage) ? Boolean(object.disableStorage) : false, + debug: isSet(object.debug) ? Boolean(object.debug) : false, + limit: isSet(object.limit) ? Number(object.limit) : 0, + enableMemory: isSet(object.enableMemory) ? Boolean(object.enableMemory) : false, + enableReturnData: isSet(object.enableReturnData) ? Boolean(object.enableReturnData) : false, + tracerConfig: isSet(object.tracerConfig) ? TracerConfig.fromJSON(object.tracerConfig) : undefined, + }; + }, + + toJSON(message: TraceConfig): unknown { + const obj: any = {}; + message.tracer !== undefined && (obj.tracer = message.tracer); + message.timeout !== undefined && (obj.timeout = message.timeout); + message.reexec !== undefined && (obj.reexec = (message.reexec || Long.UZERO).toString()); + message.disableStack !== undefined && (obj.disableStack = message.disableStack); + message.disableStorage !== undefined && (obj.disableStorage = message.disableStorage); + message.debug !== undefined && (obj.debug = message.debug); + message.limit !== undefined && (obj.limit = Math.round(message.limit)); + message.enableMemory !== undefined && (obj.enableMemory = message.enableMemory); + message.enableReturnData !== undefined && (obj.enableReturnData = message.enableReturnData); + message.tracerConfig !== undefined && + (obj.tracerConfig = message.tracerConfig ? TracerConfig.toJSON(message.tracerConfig) : undefined); + return obj; + }, + + create, I>>(base?: I): TraceConfig { + return TraceConfig.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): TraceConfig { + const message = createBaseTraceConfig(); + message.tracer = object.tracer ?? ""; + message.timeout = object.timeout ?? ""; + message.reexec = (object.reexec !== undefined && object.reexec !== null) + ? Long.fromValue(object.reexec) + : Long.UZERO; + message.disableStack = object.disableStack ?? false; + message.disableStorage = object.disableStorage ?? false; + message.debug = object.debug ?? false; + message.limit = object.limit ?? 0; + message.enableMemory = object.enableMemory ?? false; + message.enableReturnData = object.enableReturnData ?? false; + message.tracerConfig = (object.tracerConfig !== undefined && object.tracerConfig !== null) + ? TracerConfig.fromPartial(object.tracerConfig) + : undefined; + return message; + }, +}; + +declare var self: any | undefined; +declare var window: any | undefined; +declare var global: any | undefined; +var tsProtoGlobalThis: 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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (tsProtoGlobalThis.Buffer) { + return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + } else { + const bin = tsProtoGlobalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (tsProtoGlobalThis.Buffer) { + return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return tsProtoGlobalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/eth/evm/v1/genesis.ts b/src/protojs/eth/evm/v1/genesis.ts new file mode 100644 index 00000000..6109182e --- /dev/null +++ b/src/protojs/eth/evm/v1/genesis.ts @@ -0,0 +1,235 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { FunToken, Params, State } from "./evm"; + +/** Copyright (c) 2023-2024 Nibi, Inc. */ + +/** GenesisState defines the evm module's genesis state. */ +export interface GenesisState { + /** accounts is an array containing the ethereum genesis accounts. */ + accounts: GenesisAccount[]; + /** params defines all the parameters of the module. */ + params?: Params; + /** Fungible token mappings corresponding to ERC-20 smart contract tokens. */ + funtokenMappings: FunToken[]; +} + +/** + * GenesisAccount defines an account to be initialized in the genesis state. + * Its main difference between with Geth's GenesisAccount is that it uses a + * custom storage type and that it doesn't contain the private key field. + */ +export interface GenesisAccount { + /** address defines an ethereum hex formated address of an account */ + address: string; + /** code defines the hex bytes of the account code. */ + code: string; + /** storage defines the set of state key values for the account. */ + storage: State[]; +} + +function createBaseGenesisState(): GenesisState { + return { accounts: [], params: undefined, funtokenMappings: [] }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.accounts) { + GenesisAccount.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.funtokenMappings) { + FunToken.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.accounts.push(GenesisAccount.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.funtokenMappings.push(FunToken.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + accounts: Array.isArray(object?.accounts) ? object.accounts.map((e: any) => GenesisAccount.fromJSON(e)) : [], + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + funtokenMappings: Array.isArray(object?.funtokenMappings) + ? object.funtokenMappings.map((e: any) => FunToken.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.accounts) { + obj.accounts = message.accounts.map((e) => e ? GenesisAccount.toJSON(e) : undefined); + } else { + obj.accounts = []; + } + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + if (message.funtokenMappings) { + obj.funtokenMappings = message.funtokenMappings.map((e) => e ? FunToken.toJSON(e) : undefined); + } else { + obj.funtokenMappings = []; + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.accounts = object.accounts?.map((e) => GenesisAccount.fromPartial(e)) || []; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + message.funtokenMappings = object.funtokenMappings?.map((e) => FunToken.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGenesisAccount(): GenesisAccount { + return { address: "", code: "", storage: [] }; +} + +export const GenesisAccount = { + encode(message: GenesisAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.code !== "") { + writer.uint32(18).string(message.code); + } + for (const v of message.storage) { + State.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisAccount { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.code = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.storage.push(State.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisAccount { + return { + address: isSet(object.address) ? String(object.address) : "", + code: isSet(object.code) ? String(object.code) : "", + storage: Array.isArray(object?.storage) ? object.storage.map((e: any) => State.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisAccount): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.code !== undefined && (obj.code = message.code); + if (message.storage) { + obj.storage = message.storage.map((e) => e ? State.toJSON(e) : undefined); + } else { + obj.storage = []; + } + return obj; + }, + + create, I>>(base?: I): GenesisAccount { + return GenesisAccount.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): GenesisAccount { + const message = createBaseGenesisAccount(); + message.address = object.address ?? ""; + message.code = object.code ?? ""; + message.storage = object.storage?.map((e) => State.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/eth/evm/v1/query.ts b/src/protojs/eth/evm/v1/query.ts new file mode 100644 index 00000000..d466b406 --- /dev/null +++ b/src/protojs/eth/evm/v1/query.ts @@ -0,0 +1,2287 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { PageRequest, PageResponse } from "../../../cosmos/base/query/v1beta1/pagination"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { FunToken, Log, Params, TraceConfig } from "./evm"; +import { MsgEthereumTx, MsgEthereumTxResponse } from "./tx"; + +/** Copyright (c) 2023-2024 Nibi, Inc. */ + +/** QueryEthAccountRequest is the request type for the Query/Account RPC method. */ +export interface QueryEthAccountRequest { + /** address is the Ethereum hex address or nibi Bech32 address to query the account for. */ + address: string; +} + +/** QueryEthAccountResponse is the response type for the Query/EthAccount RPC method. */ +export interface QueryEthAccountResponse { + /** balance is the balance of unibi (micronibi). */ + balance: string; + /** balance_wei is the balance of wei (attoether, where NIBI is ether). */ + balanceWei: string; + /** code_hash is the hex-formatted code bytes from the EOA. */ + codeHash: string; + /** nonce is the account's sequence number. */ + nonce: Long; + /** + * eth_address: The hexadecimal-encoded string representing the 20 byte address + * of a Nibiru EVM account. + */ + ethAddress: string; + /** + * bech32_address is the nibi-prefixed address of the account that can receive + * bank transfers ("cosmos.bank.v1beta1.MsgSend"). + */ + bech32Address: string; +} + +/** + * QueryValidatorAccountRequest is the request type for the + * Query/ValidatorAccount RPC method. + */ +export interface QueryValidatorAccountRequest { + /** cons_address is the validator cons address to query the account for. */ + consAddress: string; +} + +/** + * QueryValidatorAccountResponse is the response type for the + * Query/ValidatorAccount RPC method. + */ +export interface QueryValidatorAccountResponse { + /** account_address is the Nibiru address of the account in bech32 format. */ + accountAddress: string; + /** sequence is the account's sequence number. */ + sequence: Long; + /** account_number is the account number */ + accountNumber: Long; +} + +/** QueryBalanceRequest is the request type for the Query/Balance RPC method. */ +export interface QueryBalanceRequest { + /** address is the ethereum hex address to query the balance for. */ + address: string; +} + +/** QueryBalanceResponse is the response type for the Query/Balance RPC method. */ +export interface QueryBalanceResponse { + /** balance is the balance of the EVM denomination */ + balance: string; + /** balance is the balance of the EVM denomination in units of wei. */ + balanceWei: string; +} + +/** QueryStorageRequest is the request type for the Query/Storage RPC method. */ +export interface QueryStorageRequest { + /** address is the ethereum hex address to query the storage state for. */ + address: string; + /** key defines the key of the storage state */ + key: string; +} + +/** + * QueryStorageResponse is the response type for the Query/Storage RPC + * method. + */ +export interface QueryStorageResponse { + /** value defines the storage state value hash associated with the given key. */ + value: string; +} + +/** QueryCodeRequest is the request type for the Query/Code RPC method. */ +export interface QueryCodeRequest { + /** address is the ethereum hex address to query the code for. */ + address: string; +} + +/** + * QueryCodeResponse is the response type for the Query/Code RPC + * method. + */ +export interface QueryCodeResponse { + /** code represents the code bytes from an ethereum address. */ + code: Uint8Array; +} + +/** QueryTxLogsRequest is the request type for the Query/TxLogs RPC method. */ +export interface QueryTxLogsRequest { + /** hash is the ethereum transaction hex hash to query the logs for. */ + hash: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryTxLogsResponse is the response type for the Query/TxLogs RPC method. */ +export interface QueryTxLogsResponse { + /** logs represents the ethereum logs generated from the given transaction. */ + logs: Log[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryParamsRequest defines the request type for querying x/evm parameters. */ +export interface QueryParamsRequest { +} + +/** QueryParamsResponse defines the response type for querying x/evm parameters. */ +export interface QueryParamsResponse { + /** params define the evm module parameters. */ + params?: Params; +} + +/** EthCallRequest defines EthCall request */ +export interface EthCallRequest { + /** args uses the same json format as the json rpc api. */ + args: Uint8Array; + /** gas_cap defines the default gas cap to be used */ + gasCap: Long; + /** proposer_address of the requested block in hex format */ + proposerAddress: Uint8Array; + /** chain_id is the eip155 chain id parsed from the requested block header */ + chainId: Long; +} + +/** EstimateGasResponse defines EstimateGas response */ +export interface EstimateGasResponse { + /** gas returns the estimated gas */ + gas: Long; +} + +/** QueryTraceTxRequest defines TraceTx request */ +export interface QueryTraceTxRequest { + /** msg is the MsgEthereumTx for the requested transaction */ + msg?: MsgEthereumTx; + /** trace_config holds extra parameters to trace functions. */ + traceConfig?: TraceConfig; + /** + * predecessors is an array of transactions included in the same block + * need to be replayed first to get correct context for tracing. + */ + predecessors: MsgEthereumTx[]; + /** block_number of requested transaction */ + blockNumber: Long; + /** block_hash of requested transaction */ + blockHash: string; + /** block_time of requested transaction */ + blockTime?: Date; + /** proposer_address is the proposer of the requested block */ + proposerAddress: Uint8Array; + /** chain_id is the the eip155 chain id parsed from the requested block header */ + chainId: Long; + /** block_max_gas of the block of the requested transaction */ + blockMaxGas: Long; +} + +/** QueryTraceTxResponse defines TraceTx response */ +export interface QueryTraceTxResponse { + /** data is the response serialized in bytes */ + data: Uint8Array; +} + +/** QueryTraceBlockRequest defines TraceTx request */ +export interface QueryTraceBlockRequest { + /** txs is an array of messages in the block */ + txs: MsgEthereumTx[]; + /** trace_config holds extra parameters to trace functions. */ + traceConfig?: TraceConfig; + /** block_number of the traced block */ + blockNumber: Long; + /** block_hash (hex) of the traced block */ + blockHash: string; + /** block_time of the traced block */ + blockTime?: Date; + /** proposer_address is the address of the requested block */ + proposerAddress: Uint8Array; + /** chain_id is the eip155 chain id parsed from the requested block header */ + chainId: Long; + /** block_max_gas of the traced block */ + blockMaxGas: Long; +} + +/** QueryTraceBlockResponse defines TraceBlock response */ +export interface QueryTraceBlockResponse { + /** data is the response serialized in bytes */ + data: Uint8Array; +} + +/** + * QueryBaseFeeRequest defines the request type for querying the EIP1559 base + * fee. + */ +export interface QueryBaseFeeRequest { +} + +/** + * QueryBaseFeeResponse returns the EIP1559 base fee. + * See https://github.com/ethereum/EIPs/blob/ba6c342c23164072adb500c3136e3ae6eabff306/EIPS/eip-1559.md. + */ +export interface QueryBaseFeeResponse { + /** base_fee is the EIP1559 base fee in units of wei. */ + baseFee: string; + /** base_fee is the EIP1559 base fee in units of micronibi ("unibi"). */ + baseFeeUnibi: string; +} + +export interface QueryFunTokenMappingRequest { + /** + * Either the hexadecimal-encoded ERC20 contract address or denomination of the + * Bank Coin. + */ + token: string; +} + +export interface QueryFunTokenMappingResponse { + /** fun_token is a mapping between the Bank Coin and the ERC20 contract address */ + funToken?: FunToken; +} + +function createBaseQueryEthAccountRequest(): QueryEthAccountRequest { + return { address: "" }; +} + +export const QueryEthAccountRequest = { + encode(message: QueryEthAccountRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryEthAccountRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEthAccountRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEthAccountRequest { + return { address: isSet(object.address) ? String(object.address) : "" }; + }, + + toJSON(message: QueryEthAccountRequest): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + return obj; + }, + + create, I>>(base?: I): QueryEthAccountRequest { + return QueryEthAccountRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryEthAccountRequest { + const message = createBaseQueryEthAccountRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryEthAccountResponse(): QueryEthAccountResponse { + return { balance: "", balanceWei: "", codeHash: "", nonce: Long.UZERO, ethAddress: "", bech32Address: "" }; +} + +export const QueryEthAccountResponse = { + encode(message: QueryEthAccountResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.balance !== "") { + writer.uint32(10).string(message.balance); + } + if (message.balanceWei !== "") { + writer.uint32(18).string(message.balanceWei); + } + if (message.codeHash !== "") { + writer.uint32(26).string(message.codeHash); + } + if (!message.nonce.isZero()) { + writer.uint32(32).uint64(message.nonce); + } + if (message.ethAddress !== "") { + writer.uint32(42).string(message.ethAddress); + } + if (message.bech32Address !== "") { + writer.uint32(50).string(message.bech32Address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryEthAccountResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEthAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.balance = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.balanceWei = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.codeHash = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.nonce = reader.uint64() as Long; + continue; + case 5: + if (tag !== 42) { + break; + } + + message.ethAddress = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.bech32Address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEthAccountResponse { + return { + balance: isSet(object.balance) ? String(object.balance) : "", + balanceWei: isSet(object.balanceWei) ? String(object.balanceWei) : "", + codeHash: isSet(object.codeHash) ? String(object.codeHash) : "", + nonce: isSet(object.nonce) ? Long.fromValue(object.nonce) : Long.UZERO, + ethAddress: isSet(object.ethAddress) ? String(object.ethAddress) : "", + bech32Address: isSet(object.bech32Address) ? String(object.bech32Address) : "", + }; + }, + + toJSON(message: QueryEthAccountResponse): unknown { + const obj: any = {}; + message.balance !== undefined && (obj.balance = message.balance); + message.balanceWei !== undefined && (obj.balanceWei = message.balanceWei); + message.codeHash !== undefined && (obj.codeHash = message.codeHash); + message.nonce !== undefined && (obj.nonce = (message.nonce || Long.UZERO).toString()); + message.ethAddress !== undefined && (obj.ethAddress = message.ethAddress); + message.bech32Address !== undefined && (obj.bech32Address = message.bech32Address); + return obj; + }, + + create, I>>(base?: I): QueryEthAccountResponse { + return QueryEthAccountResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryEthAccountResponse { + const message = createBaseQueryEthAccountResponse(); + message.balance = object.balance ?? ""; + message.balanceWei = object.balanceWei ?? ""; + message.codeHash = object.codeHash ?? ""; + message.nonce = (object.nonce !== undefined && object.nonce !== null) ? Long.fromValue(object.nonce) : Long.UZERO; + message.ethAddress = object.ethAddress ?? ""; + message.bech32Address = object.bech32Address ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorAccountRequest(): QueryValidatorAccountRequest { + return { consAddress: "" }; +} + +export const QueryValidatorAccountRequest = { + encode(message: QueryValidatorAccountRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.consAddress !== "") { + writer.uint32(10).string(message.consAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorAccountRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorAccountRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.consAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorAccountRequest { + return { consAddress: isSet(object.consAddress) ? String(object.consAddress) : "" }; + }, + + toJSON(message: QueryValidatorAccountRequest): unknown { + const obj: any = {}; + message.consAddress !== undefined && (obj.consAddress = message.consAddress); + return obj; + }, + + create, I>>(base?: I): QueryValidatorAccountRequest { + return QueryValidatorAccountRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryValidatorAccountRequest { + const message = createBaseQueryValidatorAccountRequest(); + message.consAddress = object.consAddress ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorAccountResponse(): QueryValidatorAccountResponse { + return { accountAddress: "", sequence: Long.UZERO, accountNumber: Long.UZERO }; +} + +export const QueryValidatorAccountResponse = { + encode(message: QueryValidatorAccountResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.accountAddress !== "") { + writer.uint32(10).string(message.accountAddress); + } + if (!message.sequence.isZero()) { + writer.uint32(16).uint64(message.sequence); + } + if (!message.accountNumber.isZero()) { + writer.uint32(24).uint64(message.accountNumber); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorAccountResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.accountAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.sequence = reader.uint64() as Long; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.accountNumber = reader.uint64() as Long; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorAccountResponse { + return { + accountAddress: isSet(object.accountAddress) ? String(object.accountAddress) : "", + sequence: isSet(object.sequence) ? Long.fromValue(object.sequence) : Long.UZERO, + accountNumber: isSet(object.accountNumber) ? Long.fromValue(object.accountNumber) : Long.UZERO, + }; + }, + + toJSON(message: QueryValidatorAccountResponse): unknown { + const obj: any = {}; + message.accountAddress !== undefined && (obj.accountAddress = message.accountAddress); + message.sequence !== undefined && (obj.sequence = (message.sequence || Long.UZERO).toString()); + message.accountNumber !== undefined && (obj.accountNumber = (message.accountNumber || Long.UZERO).toString()); + return obj; + }, + + create, I>>(base?: I): QueryValidatorAccountResponse { + return QueryValidatorAccountResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>( + object: I, + ): QueryValidatorAccountResponse { + const message = createBaseQueryValidatorAccountResponse(); + message.accountAddress = object.accountAddress ?? ""; + message.sequence = (object.sequence !== undefined && object.sequence !== null) + ? Long.fromValue(object.sequence) + : Long.UZERO; + message.accountNumber = (object.accountNumber !== undefined && object.accountNumber !== null) + ? Long.fromValue(object.accountNumber) + : Long.UZERO; + return message; + }, +}; + +function createBaseQueryBalanceRequest(): QueryBalanceRequest { + return { address: "" }; +} + +export const QueryBalanceRequest = { + encode(message: QueryBalanceRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryBalanceRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBalanceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryBalanceRequest { + return { address: isSet(object.address) ? String(object.address) : "" }; + }, + + toJSON(message: QueryBalanceRequest): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + return obj; + }, + + create, I>>(base?: I): QueryBalanceRequest { + return QueryBalanceRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryBalanceRequest { + const message = createBaseQueryBalanceRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryBalanceResponse(): QueryBalanceResponse { + return { balance: "", balanceWei: "" }; +} + +export const QueryBalanceResponse = { + encode(message: QueryBalanceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.balance !== "") { + writer.uint32(10).string(message.balance); + } + if (message.balanceWei !== "") { + writer.uint32(18).string(message.balanceWei); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryBalanceResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBalanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.balance = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.balanceWei = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryBalanceResponse { + return { + balance: isSet(object.balance) ? String(object.balance) : "", + balanceWei: isSet(object.balanceWei) ? String(object.balanceWei) : "", + }; + }, + + toJSON(message: QueryBalanceResponse): unknown { + const obj: any = {}; + message.balance !== undefined && (obj.balance = message.balance); + message.balanceWei !== undefined && (obj.balanceWei = message.balanceWei); + return obj; + }, + + create, I>>(base?: I): QueryBalanceResponse { + return QueryBalanceResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryBalanceResponse { + const message = createBaseQueryBalanceResponse(); + message.balance = object.balance ?? ""; + message.balanceWei = object.balanceWei ?? ""; + return message; + }, +}; + +function createBaseQueryStorageRequest(): QueryStorageRequest { + return { address: "", key: "" }; +} + +export const QueryStorageRequest = { + encode(message: QueryStorageRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.key !== "") { + writer.uint32(18).string(message.key); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryStorageRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryStorageRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.key = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryStorageRequest { + return { + address: isSet(object.address) ? String(object.address) : "", + key: isSet(object.key) ? String(object.key) : "", + }; + }, + + toJSON(message: QueryStorageRequest): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.key !== undefined && (obj.key = message.key); + return obj; + }, + + create, I>>(base?: I): QueryStorageRequest { + return QueryStorageRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryStorageRequest { + const message = createBaseQueryStorageRequest(); + message.address = object.address ?? ""; + message.key = object.key ?? ""; + return message; + }, +}; + +function createBaseQueryStorageResponse(): QueryStorageResponse { + return { value: "" }; +} + +export const QueryStorageResponse = { + encode(message: QueryStorageResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.value !== "") { + writer.uint32(10).string(message.value); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryStorageResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryStorageResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.value = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryStorageResponse { + return { value: isSet(object.value) ? String(object.value) : "" }; + }, + + toJSON(message: QueryStorageResponse): unknown { + const obj: any = {}; + message.value !== undefined && (obj.value = message.value); + return obj; + }, + + create, I>>(base?: I): QueryStorageResponse { + return QueryStorageResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryStorageResponse { + const message = createBaseQueryStorageResponse(); + message.value = object.value ?? ""; + return message; + }, +}; + +function createBaseQueryCodeRequest(): QueryCodeRequest { + return { address: "" }; +} + +export const QueryCodeRequest = { + encode(message: QueryCodeRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryCodeRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCodeRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCodeRequest { + return { address: isSet(object.address) ? String(object.address) : "" }; + }, + + toJSON(message: QueryCodeRequest): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + return obj; + }, + + create, I>>(base?: I): QueryCodeRequest { + return QueryCodeRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryCodeRequest { + const message = createBaseQueryCodeRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryCodeResponse(): QueryCodeResponse { + return { code: new Uint8Array(0) }; +} + +export const QueryCodeResponse = { + encode(message: QueryCodeResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.code.length !== 0) { + writer.uint32(10).bytes(message.code); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryCodeResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCodeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.code = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCodeResponse { + return { code: isSet(object.code) ? bytesFromBase64(object.code) : new Uint8Array(0) }; + }, + + toJSON(message: QueryCodeResponse): unknown { + const obj: any = {}; + message.code !== undefined && + (obj.code = base64FromBytes(message.code !== undefined ? message.code : new Uint8Array(0))); + return obj; + }, + + create, I>>(base?: I): QueryCodeResponse { + return QueryCodeResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryCodeResponse { + const message = createBaseQueryCodeResponse(); + message.code = object.code ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseQueryTxLogsRequest(): QueryTxLogsRequest { + return { hash: "", pagination: undefined }; +} + +export const QueryTxLogsRequest = { + encode(message: QueryTxLogsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.hash !== "") { + writer.uint32(10).string(message.hash); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryTxLogsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTxLogsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.hash = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTxLogsRequest { + return { + hash: isSet(object.hash) ? String(object.hash) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryTxLogsRequest): unknown { + const obj: any = {}; + message.hash !== undefined && (obj.hash = message.hash); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + create, I>>(base?: I): QueryTxLogsRequest { + return QueryTxLogsRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryTxLogsRequest { + const message = createBaseQueryTxLogsRequest(); + message.hash = object.hash ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryTxLogsResponse(): QueryTxLogsResponse { + return { logs: [], pagination: undefined }; +} + +export const QueryTxLogsResponse = { + encode(message: QueryTxLogsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.logs) { + Log.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryTxLogsResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTxLogsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.logs.push(Log.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTxLogsResponse { + return { + logs: Array.isArray(object?.logs) ? object.logs.map((e: any) => Log.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryTxLogsResponse): unknown { + const obj: any = {}; + if (message.logs) { + obj.logs = message.logs.map((e) => e ? Log.toJSON(e) : undefined); + } else { + obj.logs = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + create, I>>(base?: I): QueryTxLogsResponse { + return QueryTxLogsResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryTxLogsResponse { + const message = createBaseQueryTxLogsResponse(); + message.logs = object.logs?.map((e) => Log.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest = { + encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse = { + encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseEthCallRequest(): EthCallRequest { + return { args: new Uint8Array(0), gasCap: Long.UZERO, proposerAddress: new Uint8Array(0), chainId: Long.ZERO }; +} + +export const EthCallRequest = { + encode(message: EthCallRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.args.length !== 0) { + writer.uint32(10).bytes(message.args); + } + if (!message.gasCap.isZero()) { + writer.uint32(16).uint64(message.gasCap); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(26).bytes(message.proposerAddress); + } + if (!message.chainId.isZero()) { + writer.uint32(32).int64(message.chainId); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EthCallRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEthCallRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.args = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.gasCap = reader.uint64() as Long; + continue; + case 3: + if (tag !== 26) { + break; + } + + message.proposerAddress = reader.bytes(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.chainId = reader.int64() as Long; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): EthCallRequest { + return { + args: isSet(object.args) ? bytesFromBase64(object.args) : new Uint8Array(0), + gasCap: isSet(object.gasCap) ? Long.fromValue(object.gasCap) : Long.UZERO, + proposerAddress: isSet(object.proposerAddress) ? bytesFromBase64(object.proposerAddress) : new Uint8Array(0), + chainId: isSet(object.chainId) ? Long.fromValue(object.chainId) : Long.ZERO, + }; + }, + + toJSON(message: EthCallRequest): unknown { + const obj: any = {}; + message.args !== undefined && + (obj.args = base64FromBytes(message.args !== undefined ? message.args : new Uint8Array(0))); + message.gasCap !== undefined && (obj.gasCap = (message.gasCap || Long.UZERO).toString()); + message.proposerAddress !== undefined && + (obj.proposerAddress = base64FromBytes( + message.proposerAddress !== undefined ? message.proposerAddress : new Uint8Array(0), + )); + message.chainId !== undefined && (obj.chainId = (message.chainId || Long.ZERO).toString()); + return obj; + }, + + create, I>>(base?: I): EthCallRequest { + return EthCallRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): EthCallRequest { + const message = createBaseEthCallRequest(); + message.args = object.args ?? new Uint8Array(0); + message.gasCap = (object.gasCap !== undefined && object.gasCap !== null) + ? Long.fromValue(object.gasCap) + : Long.UZERO; + message.proposerAddress = object.proposerAddress ?? new Uint8Array(0); + message.chainId = (object.chainId !== undefined && object.chainId !== null) + ? Long.fromValue(object.chainId) + : Long.ZERO; + return message; + }, +}; + +function createBaseEstimateGasResponse(): EstimateGasResponse { + return { gas: Long.UZERO }; +} + +export const EstimateGasResponse = { + encode(message: EstimateGasResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (!message.gas.isZero()) { + writer.uint32(8).uint64(message.gas); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EstimateGasResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEstimateGasResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.gas = reader.uint64() as Long; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): EstimateGasResponse { + return { gas: isSet(object.gas) ? Long.fromValue(object.gas) : Long.UZERO }; + }, + + toJSON(message: EstimateGasResponse): unknown { + const obj: any = {}; + message.gas !== undefined && (obj.gas = (message.gas || Long.UZERO).toString()); + return obj; + }, + + create, I>>(base?: I): EstimateGasResponse { + return EstimateGasResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): EstimateGasResponse { + const message = createBaseEstimateGasResponse(); + message.gas = (object.gas !== undefined && object.gas !== null) ? Long.fromValue(object.gas) : Long.UZERO; + return message; + }, +}; + +function createBaseQueryTraceTxRequest(): QueryTraceTxRequest { + return { + msg: undefined, + traceConfig: undefined, + predecessors: [], + blockNumber: Long.ZERO, + blockHash: "", + blockTime: undefined, + proposerAddress: new Uint8Array(0), + chainId: Long.ZERO, + blockMaxGas: Long.ZERO, + }; +} + +export const QueryTraceTxRequest = { + encode(message: QueryTraceTxRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.msg !== undefined) { + MsgEthereumTx.encode(message.msg, writer.uint32(10).fork()).ldelim(); + } + if (message.traceConfig !== undefined) { + TraceConfig.encode(message.traceConfig, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.predecessors) { + MsgEthereumTx.encode(v!, writer.uint32(34).fork()).ldelim(); + } + if (!message.blockNumber.isZero()) { + writer.uint32(40).int64(message.blockNumber); + } + if (message.blockHash !== "") { + writer.uint32(50).string(message.blockHash); + } + if (message.blockTime !== undefined) { + Timestamp.encode(toTimestamp(message.blockTime), writer.uint32(58).fork()).ldelim(); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(66).bytes(message.proposerAddress); + } + if (!message.chainId.isZero()) { + writer.uint32(72).int64(message.chainId); + } + if (!message.blockMaxGas.isZero()) { + writer.uint32(80).int64(message.blockMaxGas); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryTraceTxRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTraceTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.msg = MsgEthereumTx.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.traceConfig = TraceConfig.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.predecessors.push(MsgEthereumTx.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.blockNumber = reader.int64() as Long; + continue; + case 6: + if (tag !== 50) { + break; + } + + message.blockHash = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.blockTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proposerAddress = reader.bytes(); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.chainId = reader.int64() as Long; + continue; + case 10: + if (tag !== 80) { + break; + } + + message.blockMaxGas = reader.int64() as Long; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTraceTxRequest { + return { + msg: isSet(object.msg) ? MsgEthereumTx.fromJSON(object.msg) : undefined, + traceConfig: isSet(object.traceConfig) ? TraceConfig.fromJSON(object.traceConfig) : undefined, + predecessors: Array.isArray(object?.predecessors) + ? object.predecessors.map((e: any) => MsgEthereumTx.fromJSON(e)) + : [], + blockNumber: isSet(object.blockNumber) ? Long.fromValue(object.blockNumber) : Long.ZERO, + blockHash: isSet(object.blockHash) ? String(object.blockHash) : "", + blockTime: isSet(object.blockTime) ? fromJsonTimestamp(object.blockTime) : undefined, + proposerAddress: isSet(object.proposerAddress) ? bytesFromBase64(object.proposerAddress) : new Uint8Array(0), + chainId: isSet(object.chainId) ? Long.fromValue(object.chainId) : Long.ZERO, + blockMaxGas: isSet(object.blockMaxGas) ? Long.fromValue(object.blockMaxGas) : Long.ZERO, + }; + }, + + toJSON(message: QueryTraceTxRequest): unknown { + const obj: any = {}; + message.msg !== undefined && (obj.msg = message.msg ? MsgEthereumTx.toJSON(message.msg) : undefined); + message.traceConfig !== undefined && + (obj.traceConfig = message.traceConfig ? TraceConfig.toJSON(message.traceConfig) : undefined); + if (message.predecessors) { + obj.predecessors = message.predecessors.map((e) => e ? MsgEthereumTx.toJSON(e) : undefined); + } else { + obj.predecessors = []; + } + message.blockNumber !== undefined && (obj.blockNumber = (message.blockNumber || Long.ZERO).toString()); + message.blockHash !== undefined && (obj.blockHash = message.blockHash); + message.blockTime !== undefined && (obj.blockTime = message.blockTime.toISOString()); + message.proposerAddress !== undefined && + (obj.proposerAddress = base64FromBytes( + message.proposerAddress !== undefined ? message.proposerAddress : new Uint8Array(0), + )); + message.chainId !== undefined && (obj.chainId = (message.chainId || Long.ZERO).toString()); + message.blockMaxGas !== undefined && (obj.blockMaxGas = (message.blockMaxGas || Long.ZERO).toString()); + return obj; + }, + + create, I>>(base?: I): QueryTraceTxRequest { + return QueryTraceTxRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryTraceTxRequest { + const message = createBaseQueryTraceTxRequest(); + message.msg = (object.msg !== undefined && object.msg !== null) ? MsgEthereumTx.fromPartial(object.msg) : undefined; + message.traceConfig = (object.traceConfig !== undefined && object.traceConfig !== null) + ? TraceConfig.fromPartial(object.traceConfig) + : undefined; + message.predecessors = object.predecessors?.map((e) => MsgEthereumTx.fromPartial(e)) || []; + message.blockNumber = (object.blockNumber !== undefined && object.blockNumber !== null) + ? Long.fromValue(object.blockNumber) + : Long.ZERO; + message.blockHash = object.blockHash ?? ""; + message.blockTime = object.blockTime ?? undefined; + message.proposerAddress = object.proposerAddress ?? new Uint8Array(0); + message.chainId = (object.chainId !== undefined && object.chainId !== null) + ? Long.fromValue(object.chainId) + : Long.ZERO; + message.blockMaxGas = (object.blockMaxGas !== undefined && object.blockMaxGas !== null) + ? Long.fromValue(object.blockMaxGas) + : Long.ZERO; + return message; + }, +}; + +function createBaseQueryTraceTxResponse(): QueryTraceTxResponse { + return { data: new Uint8Array(0) }; +} + +export const QueryTraceTxResponse = { + encode(message: QueryTraceTxResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryTraceTxResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTraceTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTraceTxResponse { + return { data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0) }; + }, + + toJSON(message: QueryTraceTxResponse): unknown { + const obj: any = {}; + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array(0))); + return obj; + }, + + create, I>>(base?: I): QueryTraceTxResponse { + return QueryTraceTxResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryTraceTxResponse { + const message = createBaseQueryTraceTxResponse(); + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseQueryTraceBlockRequest(): QueryTraceBlockRequest { + return { + txs: [], + traceConfig: undefined, + blockNumber: Long.ZERO, + blockHash: "", + blockTime: undefined, + proposerAddress: new Uint8Array(0), + chainId: Long.ZERO, + blockMaxGas: Long.ZERO, + }; +} + +export const QueryTraceBlockRequest = { + encode(message: QueryTraceBlockRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.txs) { + MsgEthereumTx.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.traceConfig !== undefined) { + TraceConfig.encode(message.traceConfig, writer.uint32(26).fork()).ldelim(); + } + if (!message.blockNumber.isZero()) { + writer.uint32(40).int64(message.blockNumber); + } + if (message.blockHash !== "") { + writer.uint32(50).string(message.blockHash); + } + if (message.blockTime !== undefined) { + Timestamp.encode(toTimestamp(message.blockTime), writer.uint32(58).fork()).ldelim(); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(66).bytes(message.proposerAddress); + } + if (!message.chainId.isZero()) { + writer.uint32(72).int64(message.chainId); + } + if (!message.blockMaxGas.isZero()) { + writer.uint32(80).int64(message.blockMaxGas); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryTraceBlockRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTraceBlockRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txs.push(MsgEthereumTx.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.traceConfig = TraceConfig.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.blockNumber = reader.int64() as Long; + continue; + case 6: + if (tag !== 50) { + break; + } + + message.blockHash = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.blockTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proposerAddress = reader.bytes(); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.chainId = reader.int64() as Long; + continue; + case 10: + if (tag !== 80) { + break; + } + + message.blockMaxGas = reader.int64() as Long; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTraceBlockRequest { + return { + txs: Array.isArray(object?.txs) ? object.txs.map((e: any) => MsgEthereumTx.fromJSON(e)) : [], + traceConfig: isSet(object.traceConfig) ? TraceConfig.fromJSON(object.traceConfig) : undefined, + blockNumber: isSet(object.blockNumber) ? Long.fromValue(object.blockNumber) : Long.ZERO, + blockHash: isSet(object.blockHash) ? String(object.blockHash) : "", + blockTime: isSet(object.blockTime) ? fromJsonTimestamp(object.blockTime) : undefined, + proposerAddress: isSet(object.proposerAddress) ? bytesFromBase64(object.proposerAddress) : new Uint8Array(0), + chainId: isSet(object.chainId) ? Long.fromValue(object.chainId) : Long.ZERO, + blockMaxGas: isSet(object.blockMaxGas) ? Long.fromValue(object.blockMaxGas) : Long.ZERO, + }; + }, + + toJSON(message: QueryTraceBlockRequest): unknown { + const obj: any = {}; + if (message.txs) { + obj.txs = message.txs.map((e) => e ? MsgEthereumTx.toJSON(e) : undefined); + } else { + obj.txs = []; + } + message.traceConfig !== undefined && + (obj.traceConfig = message.traceConfig ? TraceConfig.toJSON(message.traceConfig) : undefined); + message.blockNumber !== undefined && (obj.blockNumber = (message.blockNumber || Long.ZERO).toString()); + message.blockHash !== undefined && (obj.blockHash = message.blockHash); + message.blockTime !== undefined && (obj.blockTime = message.blockTime.toISOString()); + message.proposerAddress !== undefined && + (obj.proposerAddress = base64FromBytes( + message.proposerAddress !== undefined ? message.proposerAddress : new Uint8Array(0), + )); + message.chainId !== undefined && (obj.chainId = (message.chainId || Long.ZERO).toString()); + message.blockMaxGas !== undefined && (obj.blockMaxGas = (message.blockMaxGas || Long.ZERO).toString()); + return obj; + }, + + create, I>>(base?: I): QueryTraceBlockRequest { + return QueryTraceBlockRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryTraceBlockRequest { + const message = createBaseQueryTraceBlockRequest(); + message.txs = object.txs?.map((e) => MsgEthereumTx.fromPartial(e)) || []; + message.traceConfig = (object.traceConfig !== undefined && object.traceConfig !== null) + ? TraceConfig.fromPartial(object.traceConfig) + : undefined; + message.blockNumber = (object.blockNumber !== undefined && object.blockNumber !== null) + ? Long.fromValue(object.blockNumber) + : Long.ZERO; + message.blockHash = object.blockHash ?? ""; + message.blockTime = object.blockTime ?? undefined; + message.proposerAddress = object.proposerAddress ?? new Uint8Array(0); + message.chainId = (object.chainId !== undefined && object.chainId !== null) + ? Long.fromValue(object.chainId) + : Long.ZERO; + message.blockMaxGas = (object.blockMaxGas !== undefined && object.blockMaxGas !== null) + ? Long.fromValue(object.blockMaxGas) + : Long.ZERO; + return message; + }, +}; + +function createBaseQueryTraceBlockResponse(): QueryTraceBlockResponse { + return { data: new Uint8Array(0) }; +} + +export const QueryTraceBlockResponse = { + encode(message: QueryTraceBlockResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryTraceBlockResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTraceBlockResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTraceBlockResponse { + return { data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0) }; + }, + + toJSON(message: QueryTraceBlockResponse): unknown { + const obj: any = {}; + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array(0))); + return obj; + }, + + create, I>>(base?: I): QueryTraceBlockResponse { + return QueryTraceBlockResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryTraceBlockResponse { + const message = createBaseQueryTraceBlockResponse(); + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseQueryBaseFeeRequest(): QueryBaseFeeRequest { + return {}; +} + +export const QueryBaseFeeRequest = { + encode(_: QueryBaseFeeRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryBaseFeeRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBaseFeeRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryBaseFeeRequest { + return {}; + }, + + toJSON(_: QueryBaseFeeRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryBaseFeeRequest { + return QueryBaseFeeRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>(_: I): QueryBaseFeeRequest { + const message = createBaseQueryBaseFeeRequest(); + return message; + }, +}; + +function createBaseQueryBaseFeeResponse(): QueryBaseFeeResponse { + return { baseFee: "", baseFeeUnibi: "" }; +} + +export const QueryBaseFeeResponse = { + encode(message: QueryBaseFeeResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.baseFee !== "") { + writer.uint32(10).string(message.baseFee); + } + if (message.baseFeeUnibi !== "") { + writer.uint32(18).string(message.baseFeeUnibi); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryBaseFeeResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBaseFeeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.baseFee = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.baseFeeUnibi = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryBaseFeeResponse { + return { + baseFee: isSet(object.baseFee) ? String(object.baseFee) : "", + baseFeeUnibi: isSet(object.baseFeeUnibi) ? String(object.baseFeeUnibi) : "", + }; + }, + + toJSON(message: QueryBaseFeeResponse): unknown { + const obj: any = {}; + message.baseFee !== undefined && (obj.baseFee = message.baseFee); + message.baseFeeUnibi !== undefined && (obj.baseFeeUnibi = message.baseFeeUnibi); + return obj; + }, + + create, I>>(base?: I): QueryBaseFeeResponse { + return QueryBaseFeeResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryBaseFeeResponse { + const message = createBaseQueryBaseFeeResponse(); + message.baseFee = object.baseFee ?? ""; + message.baseFeeUnibi = object.baseFeeUnibi ?? ""; + return message; + }, +}; + +function createBaseQueryFunTokenMappingRequest(): QueryFunTokenMappingRequest { + return { token: "" }; +} + +export const QueryFunTokenMappingRequest = { + encode(message: QueryFunTokenMappingRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.token !== "") { + writer.uint32(10).string(message.token); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryFunTokenMappingRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryFunTokenMappingRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.token = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryFunTokenMappingRequest { + return { token: isSet(object.token) ? String(object.token) : "" }; + }, + + toJSON(message: QueryFunTokenMappingRequest): unknown { + const obj: any = {}; + message.token !== undefined && (obj.token = message.token); + return obj; + }, + + create, I>>(base?: I): QueryFunTokenMappingRequest { + return QueryFunTokenMappingRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryFunTokenMappingRequest { + const message = createBaseQueryFunTokenMappingRequest(); + message.token = object.token ?? ""; + return message; + }, +}; + +function createBaseQueryFunTokenMappingResponse(): QueryFunTokenMappingResponse { + return { funToken: undefined }; +} + +export const QueryFunTokenMappingResponse = { + encode(message: QueryFunTokenMappingResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.funToken !== undefined) { + FunToken.encode(message.funToken, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryFunTokenMappingResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryFunTokenMappingResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.funToken = FunToken.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryFunTokenMappingResponse { + return { funToken: isSet(object.funToken) ? FunToken.fromJSON(object.funToken) : undefined }; + }, + + toJSON(message: QueryFunTokenMappingResponse): unknown { + const obj: any = {}; + message.funToken !== undefined && (obj.funToken = message.funToken ? FunToken.toJSON(message.funToken) : undefined); + return obj; + }, + + create, I>>(base?: I): QueryFunTokenMappingResponse { + return QueryFunTokenMappingResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryFunTokenMappingResponse { + const message = createBaseQueryFunTokenMappingResponse(); + message.funToken = (object.funToken !== undefined && object.funToken !== null) + ? FunToken.fromPartial(object.funToken) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** + * EthAccount queries a Nibiru account using its EVM address or Bech32 Nibiru + * address. + */ + EthAccount(request: QueryEthAccountRequest): Promise; + /** + * ValidatorAccount queries an Ethereum account's from a validator consensus + * Address. + */ + ValidatorAccount(request: QueryValidatorAccountRequest): Promise; + /** + * Balance queries the balance of a the EVM denomination for a single + * EthAccount. + */ + Balance(request: QueryBalanceRequest): Promise; + /** Storage queries the balance of all coins for a single account. */ + Storage(request: QueryStorageRequest): Promise; + /** Code queries the balance of all coins for a single account. */ + Code(request: QueryCodeRequest): Promise; + /** Params queries the parameters of x/evm module. */ + Params(request: QueryParamsRequest): Promise; + /** EthCall implements the `eth_call` rpc api */ + EthCall(request: EthCallRequest): Promise; + /** EstimateGas implements the `eth_estimateGas` rpc api */ + EstimateGas(request: EthCallRequest): Promise; + /** TraceTx implements the `debug_traceTransaction` rpc api */ + TraceTx(request: QueryTraceTxRequest): Promise; + /** TraceBlock implements the `debug_traceBlockByNumber` and `debug_traceBlockByHash` rpc api */ + TraceBlock(request: QueryTraceBlockRequest): Promise; + /** TraceCall implements the `debug_traceCall` rpc api */ + TraceCall(request: QueryTraceTxRequest): Promise; + /** + * BaseFee queries the base fee of the parent block of the current block, + * Similar to feemarket module's method + */ + BaseFee(request: QueryBaseFeeRequest): Promise; + FunTokenMapping(request: QueryFunTokenMappingRequest): Promise; +} + +export const QueryServiceName = "eth.evm.v1.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.EthAccount = this.EthAccount.bind(this); + this.ValidatorAccount = this.ValidatorAccount.bind(this); + this.Balance = this.Balance.bind(this); + this.Storage = this.Storage.bind(this); + this.Code = this.Code.bind(this); + this.Params = this.Params.bind(this); + this.EthCall = this.EthCall.bind(this); + this.EstimateGas = this.EstimateGas.bind(this); + this.TraceTx = this.TraceTx.bind(this); + this.TraceBlock = this.TraceBlock.bind(this); + this.TraceCall = this.TraceCall.bind(this); + this.BaseFee = this.BaseFee.bind(this); + this.FunTokenMapping = this.FunTokenMapping.bind(this); + } + EthAccount(request: QueryEthAccountRequest): Promise { + const data = QueryEthAccountRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EthAccount", data); + return promise.then((data) => QueryEthAccountResponse.decode(_m0.Reader.create(data))); + } + + ValidatorAccount(request: QueryValidatorAccountRequest): Promise { + const data = QueryValidatorAccountRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorAccount", data); + return promise.then((data) => QueryValidatorAccountResponse.decode(_m0.Reader.create(data))); + } + + Balance(request: QueryBalanceRequest): Promise { + const data = QueryBalanceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Balance", data); + return promise.then((data) => QueryBalanceResponse.decode(_m0.Reader.create(data))); + } + + Storage(request: QueryStorageRequest): Promise { + const data = QueryStorageRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Storage", data); + return promise.then((data) => QueryStorageResponse.decode(_m0.Reader.create(data))); + } + + Code(request: QueryCodeRequest): Promise { + const data = QueryCodeRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Code", data); + return promise.then((data) => QueryCodeResponse.decode(_m0.Reader.create(data))); + } + + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => QueryParamsResponse.decode(_m0.Reader.create(data))); + } + + EthCall(request: EthCallRequest): Promise { + const data = EthCallRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EthCall", data); + return promise.then((data) => MsgEthereumTxResponse.decode(_m0.Reader.create(data))); + } + + EstimateGas(request: EthCallRequest): Promise { + const data = EthCallRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EstimateGas", data); + return promise.then((data) => EstimateGasResponse.decode(_m0.Reader.create(data))); + } + + TraceTx(request: QueryTraceTxRequest): Promise { + const data = QueryTraceTxRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "TraceTx", data); + return promise.then((data) => QueryTraceTxResponse.decode(_m0.Reader.create(data))); + } + + TraceBlock(request: QueryTraceBlockRequest): Promise { + const data = QueryTraceBlockRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "TraceBlock", data); + return promise.then((data) => QueryTraceBlockResponse.decode(_m0.Reader.create(data))); + } + + TraceCall(request: QueryTraceTxRequest): Promise { + const data = QueryTraceTxRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "TraceCall", data); + return promise.then((data) => QueryTraceTxResponse.decode(_m0.Reader.create(data))); + } + + BaseFee(request: QueryBaseFeeRequest): Promise { + const data = QueryBaseFeeRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "BaseFee", data); + return promise.then((data) => QueryBaseFeeResponse.decode(_m0.Reader.create(data))); + } + + FunTokenMapping(request: QueryFunTokenMappingRequest): Promise { + const data = QueryFunTokenMappingRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "FunTokenMapping", data); + return promise.then((data) => QueryFunTokenMappingResponse.decode(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +declare var self: any | undefined; +declare var window: any | undefined; +declare var global: any | undefined; +var tsProtoGlobalThis: 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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (tsProtoGlobalThis.Buffer) { + return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + } else { + const bin = tsProtoGlobalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (tsProtoGlobalThis.Buffer) { + return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return tsProtoGlobalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function toTimestamp(date: Date): Timestamp { + const seconds = numberToLong(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.toNumber() || 0) * 1_000; + millis += (t.nanos || 0) / 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 numberToLong(number: number) { + return Long.fromNumber(number); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/eth/evm/v1/tx.ts b/src/protojs/eth/evm/v1/tx.ts new file mode 100644 index 00000000..f61a5a22 --- /dev/null +++ b/src/protojs/eth/evm/v1/tx.ts @@ -0,0 +1,1610 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../../cosmos/base/v1beta1/coin"; +import { Any } from "../../../google/protobuf/any"; +import { AccessTuple, FunToken, Log, Params } from "./evm"; + +/** Copyright (c) 2023-2024 Nibi, Inc. */ + +/** MsgEthereumTx encapsulates an Ethereum transaction as an SDK message. */ +export interface MsgEthereumTx { + /** data is inner transaction data of the Ethereum transaction */ + data?: Any; + /** size is the encoded storage size of the transaction (DEPRECATED) */ + size: number; + /** hash of the transaction in hex format */ + hash: string; + /** + * from is the ethereum signer address in hex format. This address value is checked + * against the address derived from the signature (V, R, S) using the + * secp256k1 elliptic curve + */ + from: string; +} + +/** + * LegacyTx is the transaction data of regular Ethereum transactions. + * + * Note that setting "evm.Params.AllowUnprotectedTxs" to false will cause all + * non-EIP155 signed transactions to fail, as they'll lack replay protection. + * + * LegacyTx is a custom implementation of "LegacyTx" from + * "github.com/ethereum/go-ethereum/core/types". + */ +export interface LegacyTx { + /** nonce corresponds to the account nonce (transaction sequence). */ + nonce: Long; + /** gas_price defines the value for each gas unit */ + gasPrice: string; + /** gas defines the gas limit defined for the transaction. */ + gas: Long; + /** to is the hex formatted address of the recipient */ + to: string; + /** value defines the unsigned integer value of the transaction amount. */ + value: string; + /** data is the data payload bytes of the transaction. */ + data: Uint8Array; + /** + * v defines the recovery id as the "v" signature value from the elliptic curve + * digital signatute algorithm (ECDSA). It indicates which of two possible + * solutions should be used to reconstruct the public key from the signature. + * In Ethereum, "v" takes the value 27 or 28 for transactions that are not + * relay-protected. + */ + v: Uint8Array; + /** + * r defines the x-coordinate of a point on the elliptic curve in the elliptic curve + * digital signatute algorithm (ECDSA). It's crucial in ensuring uniqueness of + * the signature. + */ + r: Uint8Array; + /** + * s define the signature value derived from the private key, message hash, and + * the value of "r". It ensures that the signature is tied to both the message + * and the private key of the sender. + */ + s: Uint8Array; +} + +/** + * AccessListTx is the data of EIP-2930 access list transactions. + * It is a custom implementation of "AccessListTx" from + * "github.com/ethereum/go-ethereum/core/types". + */ +export interface AccessListTx { + /** chain_id of the destination EVM chain */ + chainId: string; + /** nonce corresponds to the account nonce (transaction sequence). */ + nonce: Long; + /** gas_price defines the value for each gas unit */ + gasPrice: string; + /** gas defines the gas limit defined for the transaction. */ + gas: Long; + /** to is the recipient address in hex format */ + to: string; + /** value defines the unsigned integer value of the transaction amount. */ + value: string; + /** data is the data payload bytes of the transaction. */ + data: Uint8Array; + /** accesses is an array of access tuples */ + accesses: AccessTuple[]; + /** + * v defines the recovery id and "v" signature value from the elliptic curve + * digital signatute algorithm (ECDSA). It indicates which of two possible + * solutions should be used to reconstruct the public key from the signature. + * In Ethereum, "v" takes the value 27 or 28 for transactions that are not + * relay-protected. + */ + v: Uint8Array; + /** + * r defines the x-coordinate of a point on the elliptic curve in the elliptic curve + * digital signatute algorithm (ECDSA). It's crucial in ensuring uniqueness of + * the signature. + */ + r: Uint8Array; + /** + * s define the signature value derived from the private key, message hash, and + * the value of "r". It ensures that the signature is tied to both the message + * and the private key of the sender. + */ + s: Uint8Array; +} + +/** + * DynamicFeeTx is the data of EIP-1559 dynamic fee transactions. It is a custom + * implementation of "DynamicFeeTx" from + * "github.com/ethereum/go-ethereum/core/types". + */ +export interface DynamicFeeTx { + /** chain_id of the destination EVM chain */ + chainId: string; + /** nonce corresponds to the account nonce (transaction sequence). */ + nonce: Long; + /** gas_tip_cap defines the max value for the gas tip */ + gasTipCap: string; + /** gas_fee_cap defines the max value for the gas fee */ + gasFeeCap: string; + /** gas defines the gas limit defined for the transaction. */ + gas: Long; + /** to is the hex formatted address of the recipient */ + to: string; + /** value defines the the transaction amount. */ + value: string; + /** data is the data payload bytes of the transaction. */ + data: Uint8Array; + /** accesses is an array of access tuples */ + accesses: AccessTuple[]; + /** + * v defines the recovery id and "v" signature value from the elliptic curve + * digital signatute algorithm (ECDSA). It indicates which of two possible + * solutions should be used to reconstruct the public key from the signature. + * In Ethereum, "v" takes the value 27 or 28 for transactions that are not + * relay-protected. + */ + v: Uint8Array; + /** + * r defines the x-coordinate of a point on the elliptic curve in the elliptic curve + * digital signatute algorithm (ECDSA). It's crucial in ensuring uniqueness of + * the signature. + */ + r: Uint8Array; + /** + * s define the signature value derived from the private key, message hash, and + * the value of "r". It ensures that the signature is tied to both the message + * and the private key of the sender. + */ + s: Uint8Array; +} + +/** ExtensionOptionsEthereumTx is an extension option for ethereum transactions */ +export interface ExtensionOptionsEthereumTx { +} + +/** MsgEthereumTxResponse defines the Msg/EthereumTx response type. */ +export interface MsgEthereumTxResponse { + /** + * hash of the ethereum transaction in hex format. This hash differs from the + * Tendermint sha256 hash of the transaction bytes. See + * https://github.com/tendermint/tendermint/issues/6539 for reference + */ + hash: string; + /** + * logs contains the transaction hash and the proto-compatible ethereum + * logs. + */ + logs: Log[]; + /** + * ret is the returned data from evm function (result or data supplied with revert + * opcode) + */ + ret: Uint8Array; + /** vm_error is the error returned by vm execution */ + vmError: string; + /** gas_used specifies how much gas was consumed by the transaction */ + gasUsed: Long; +} + +/** MsgUpdateParams defines a Msg for updating the x/evm module parameters. */ +export interface MsgUpdateParams { + /** authority is the address of the governance account. */ + authority: string; + /** + * params defines the x/evm parameters to update. + * NOTE: All parameters must be supplied. + */ + params?: Params; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse { +} + +/** + * MsgCreateFunToken: Arguments to create a "FunToken" mapping. Either the ERC20 + * contract address can be given to create the mapping to a Bank Coin, or the + * denomination for a Bank Coin can be given to create the mapping to an ERC20. + */ +export interface MsgCreateFunToken { + /** Hexadecimal address of the ERC20 token to which the `FunToken` maps */ + fromErc20: string; + /** Coin denomination in the Bank Module. */ + fromBankDenom: string; + /** Sender: Address for the signer of the transaction. */ + sender: string; +} + +export interface MsgCreateFunTokenResponse { + /** Fungible token mapping corresponding to ERC20 tokens. */ + funtokenMapping?: FunToken; +} + +/** MsgConvertCoinToEvm: Arguments to send a Bank Coin to ERC-20 representation */ +export interface MsgConvertCoinToEvm { + /** Hexadecimal address of the ERC20 token to which the `FunToken` maps */ + toEthAddr: string; + /** Sender: Address for the signer of the transaction. */ + sender: string; + /** Bank Coin to get converted to ERC20 */ + bankCoin?: Coin; +} + +export interface MsgConvertCoinToEvmResponse { +} + +function createBaseMsgEthereumTx(): MsgEthereumTx { + return { data: undefined, size: 0, hash: "", from: "" }; +} + +export const MsgEthereumTx = { + encode(message: MsgEthereumTx, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.data !== undefined) { + Any.encode(message.data, writer.uint32(10).fork()).ldelim(); + } + if (message.size !== 0) { + writer.uint32(17).double(message.size); + } + if (message.hash !== "") { + writer.uint32(26).string(message.hash); + } + if (message.from !== "") { + writer.uint32(34).string(message.from); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgEthereumTx { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgEthereumTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = Any.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 17) { + break; + } + + message.size = reader.double(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.hash = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.from = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgEthereumTx { + return { + data: isSet(object.data) ? Any.fromJSON(object.data) : undefined, + size: isSet(object.size) ? Number(object.size) : 0, + hash: isSet(object.hash) ? String(object.hash) : "", + from: isSet(object.from) ? String(object.from) : "", + }; + }, + + toJSON(message: MsgEthereumTx): unknown { + const obj: any = {}; + message.data !== undefined && (obj.data = message.data ? Any.toJSON(message.data) : undefined); + message.size !== undefined && (obj.size = message.size); + message.hash !== undefined && (obj.hash = message.hash); + message.from !== undefined && (obj.from = message.from); + return obj; + }, + + create, I>>(base?: I): MsgEthereumTx { + return MsgEthereumTx.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): MsgEthereumTx { + const message = createBaseMsgEthereumTx(); + message.data = (object.data !== undefined && object.data !== null) ? Any.fromPartial(object.data) : undefined; + message.size = object.size ?? 0; + message.hash = object.hash ?? ""; + message.from = object.from ?? ""; + return message; + }, +}; + +function createBaseLegacyTx(): LegacyTx { + return { + nonce: Long.UZERO, + gasPrice: "", + gas: Long.UZERO, + to: "", + value: "", + data: new Uint8Array(0), + v: new Uint8Array(0), + r: new Uint8Array(0), + s: new Uint8Array(0), + }; +} + +export const LegacyTx = { + encode(message: LegacyTx, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (!message.nonce.isZero()) { + writer.uint32(8).uint64(message.nonce); + } + if (message.gasPrice !== "") { + writer.uint32(18).string(message.gasPrice); + } + if (!message.gas.isZero()) { + writer.uint32(24).uint64(message.gas); + } + if (message.to !== "") { + writer.uint32(34).string(message.to); + } + if (message.value !== "") { + writer.uint32(42).string(message.value); + } + if (message.data.length !== 0) { + writer.uint32(50).bytes(message.data); + } + if (message.v.length !== 0) { + writer.uint32(58).bytes(message.v); + } + if (message.r.length !== 0) { + writer.uint32(66).bytes(message.r); + } + if (message.s.length !== 0) { + writer.uint32(74).bytes(message.s); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): LegacyTx { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLegacyTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.nonce = reader.uint64() as Long; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.gasPrice = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.gas = reader.uint64() as Long; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.to = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.value = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.data = reader.bytes(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.v = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.r = reader.bytes(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.s = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): LegacyTx { + return { + nonce: isSet(object.nonce) ? Long.fromValue(object.nonce) : Long.UZERO, + gasPrice: isSet(object.gasPrice) ? String(object.gasPrice) : "", + gas: isSet(object.gas) ? Long.fromValue(object.gas) : Long.UZERO, + to: isSet(object.to) ? String(object.to) : "", + value: isSet(object.value) ? String(object.value) : "", + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + v: isSet(object.v) ? bytesFromBase64(object.v) : new Uint8Array(0), + r: isSet(object.r) ? bytesFromBase64(object.r) : new Uint8Array(0), + s: isSet(object.s) ? bytesFromBase64(object.s) : new Uint8Array(0), + }; + }, + + toJSON(message: LegacyTx): unknown { + const obj: any = {}; + message.nonce !== undefined && (obj.nonce = (message.nonce || Long.UZERO).toString()); + message.gasPrice !== undefined && (obj.gasPrice = message.gasPrice); + message.gas !== undefined && (obj.gas = (message.gas || Long.UZERO).toString()); + message.to !== undefined && (obj.to = message.to); + message.value !== undefined && (obj.value = message.value); + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array(0))); + message.v !== undefined && (obj.v = base64FromBytes(message.v !== undefined ? message.v : new Uint8Array(0))); + message.r !== undefined && (obj.r = base64FromBytes(message.r !== undefined ? message.r : new Uint8Array(0))); + message.s !== undefined && (obj.s = base64FromBytes(message.s !== undefined ? message.s : new Uint8Array(0))); + return obj; + }, + + create, I>>(base?: I): LegacyTx { + return LegacyTx.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): LegacyTx { + const message = createBaseLegacyTx(); + message.nonce = (object.nonce !== undefined && object.nonce !== null) ? Long.fromValue(object.nonce) : Long.UZERO; + message.gasPrice = object.gasPrice ?? ""; + message.gas = (object.gas !== undefined && object.gas !== null) ? Long.fromValue(object.gas) : Long.UZERO; + message.to = object.to ?? ""; + message.value = object.value ?? ""; + message.data = object.data ?? new Uint8Array(0); + message.v = object.v ?? new Uint8Array(0); + message.r = object.r ?? new Uint8Array(0); + message.s = object.s ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseAccessListTx(): AccessListTx { + return { + chainId: "", + nonce: Long.UZERO, + gasPrice: "", + gas: Long.UZERO, + to: "", + value: "", + data: new Uint8Array(0), + accesses: [], + v: new Uint8Array(0), + r: new Uint8Array(0), + s: new Uint8Array(0), + }; +} + +export const AccessListTx = { + encode(message: AccessListTx, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.chainId !== "") { + writer.uint32(10).string(message.chainId); + } + if (!message.nonce.isZero()) { + writer.uint32(16).uint64(message.nonce); + } + if (message.gasPrice !== "") { + writer.uint32(26).string(message.gasPrice); + } + if (!message.gas.isZero()) { + writer.uint32(32).uint64(message.gas); + } + if (message.to !== "") { + writer.uint32(42).string(message.to); + } + if (message.value !== "") { + writer.uint32(50).string(message.value); + } + if (message.data.length !== 0) { + writer.uint32(58).bytes(message.data); + } + for (const v of message.accesses) { + AccessTuple.encode(v!, writer.uint32(66).fork()).ldelim(); + } + if (message.v.length !== 0) { + writer.uint32(74).bytes(message.v); + } + if (message.r.length !== 0) { + writer.uint32(82).bytes(message.r); + } + if (message.s.length !== 0) { + writer.uint32(90).bytes(message.s); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AccessListTx { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAccessListTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.chainId = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.nonce = reader.uint64() as Long; + continue; + case 3: + if (tag !== 26) { + break; + } + + message.gasPrice = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.gas = reader.uint64() as Long; + continue; + case 5: + if (tag !== 42) { + break; + } + + message.to = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.value = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.data = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.accesses.push(AccessTuple.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.v = reader.bytes(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.r = reader.bytes(); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.s = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): AccessListTx { + return { + chainId: isSet(object.chainId) ? String(object.chainId) : "", + nonce: isSet(object.nonce) ? Long.fromValue(object.nonce) : Long.UZERO, + gasPrice: isSet(object.gasPrice) ? String(object.gasPrice) : "", + gas: isSet(object.gas) ? Long.fromValue(object.gas) : Long.UZERO, + to: isSet(object.to) ? String(object.to) : "", + value: isSet(object.value) ? String(object.value) : "", + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + accesses: Array.isArray(object?.accesses) ? object.accesses.map((e: any) => AccessTuple.fromJSON(e)) : [], + v: isSet(object.v) ? bytesFromBase64(object.v) : new Uint8Array(0), + r: isSet(object.r) ? bytesFromBase64(object.r) : new Uint8Array(0), + s: isSet(object.s) ? bytesFromBase64(object.s) : new Uint8Array(0), + }; + }, + + toJSON(message: AccessListTx): unknown { + const obj: any = {}; + message.chainId !== undefined && (obj.chainId = message.chainId); + message.nonce !== undefined && (obj.nonce = (message.nonce || Long.UZERO).toString()); + message.gasPrice !== undefined && (obj.gasPrice = message.gasPrice); + message.gas !== undefined && (obj.gas = (message.gas || Long.UZERO).toString()); + message.to !== undefined && (obj.to = message.to); + message.value !== undefined && (obj.value = message.value); + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array(0))); + if (message.accesses) { + obj.accesses = message.accesses.map((e) => e ? AccessTuple.toJSON(e) : undefined); + } else { + obj.accesses = []; + } + message.v !== undefined && (obj.v = base64FromBytes(message.v !== undefined ? message.v : new Uint8Array(0))); + message.r !== undefined && (obj.r = base64FromBytes(message.r !== undefined ? message.r : new Uint8Array(0))); + message.s !== undefined && (obj.s = base64FromBytes(message.s !== undefined ? message.s : new Uint8Array(0))); + return obj; + }, + + create, I>>(base?: I): AccessListTx { + return AccessListTx.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): AccessListTx { + const message = createBaseAccessListTx(); + message.chainId = object.chainId ?? ""; + message.nonce = (object.nonce !== undefined && object.nonce !== null) ? Long.fromValue(object.nonce) : Long.UZERO; + message.gasPrice = object.gasPrice ?? ""; + message.gas = (object.gas !== undefined && object.gas !== null) ? Long.fromValue(object.gas) : Long.UZERO; + message.to = object.to ?? ""; + message.value = object.value ?? ""; + message.data = object.data ?? new Uint8Array(0); + message.accesses = object.accesses?.map((e) => AccessTuple.fromPartial(e)) || []; + message.v = object.v ?? new Uint8Array(0); + message.r = object.r ?? new Uint8Array(0); + message.s = object.s ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseDynamicFeeTx(): DynamicFeeTx { + return { + chainId: "", + nonce: Long.UZERO, + gasTipCap: "", + gasFeeCap: "", + gas: Long.UZERO, + to: "", + value: "", + data: new Uint8Array(0), + accesses: [], + v: new Uint8Array(0), + r: new Uint8Array(0), + s: new Uint8Array(0), + }; +} + +export const DynamicFeeTx = { + encode(message: DynamicFeeTx, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.chainId !== "") { + writer.uint32(10).string(message.chainId); + } + if (!message.nonce.isZero()) { + writer.uint32(16).uint64(message.nonce); + } + if (message.gasTipCap !== "") { + writer.uint32(26).string(message.gasTipCap); + } + if (message.gasFeeCap !== "") { + writer.uint32(34).string(message.gasFeeCap); + } + if (!message.gas.isZero()) { + writer.uint32(40).uint64(message.gas); + } + if (message.to !== "") { + writer.uint32(50).string(message.to); + } + if (message.value !== "") { + writer.uint32(58).string(message.value); + } + if (message.data.length !== 0) { + writer.uint32(66).bytes(message.data); + } + for (const v of message.accesses) { + AccessTuple.encode(v!, writer.uint32(74).fork()).ldelim(); + } + if (message.v.length !== 0) { + writer.uint32(82).bytes(message.v); + } + if (message.r.length !== 0) { + writer.uint32(90).bytes(message.r); + } + if (message.s.length !== 0) { + writer.uint32(98).bytes(message.s); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DynamicFeeTx { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDynamicFeeTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.chainId = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.nonce = reader.uint64() as Long; + continue; + case 3: + if (tag !== 26) { + break; + } + + message.gasTipCap = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.gasFeeCap = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.gas = reader.uint64() as Long; + continue; + case 6: + if (tag !== 50) { + break; + } + + message.to = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.value = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.data = reader.bytes(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.accesses.push(AccessTuple.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.v = reader.bytes(); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.r = reader.bytes(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.s = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DynamicFeeTx { + return { + chainId: isSet(object.chainId) ? String(object.chainId) : "", + nonce: isSet(object.nonce) ? Long.fromValue(object.nonce) : Long.UZERO, + gasTipCap: isSet(object.gasTipCap) ? String(object.gasTipCap) : "", + gasFeeCap: isSet(object.gasFeeCap) ? String(object.gasFeeCap) : "", + gas: isSet(object.gas) ? Long.fromValue(object.gas) : Long.UZERO, + to: isSet(object.to) ? String(object.to) : "", + value: isSet(object.value) ? String(object.value) : "", + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + accesses: Array.isArray(object?.accesses) ? object.accesses.map((e: any) => AccessTuple.fromJSON(e)) : [], + v: isSet(object.v) ? bytesFromBase64(object.v) : new Uint8Array(0), + r: isSet(object.r) ? bytesFromBase64(object.r) : new Uint8Array(0), + s: isSet(object.s) ? bytesFromBase64(object.s) : new Uint8Array(0), + }; + }, + + toJSON(message: DynamicFeeTx): unknown { + const obj: any = {}; + message.chainId !== undefined && (obj.chainId = message.chainId); + message.nonce !== undefined && (obj.nonce = (message.nonce || Long.UZERO).toString()); + message.gasTipCap !== undefined && (obj.gasTipCap = message.gasTipCap); + message.gasFeeCap !== undefined && (obj.gasFeeCap = message.gasFeeCap); + message.gas !== undefined && (obj.gas = (message.gas || Long.UZERO).toString()); + message.to !== undefined && (obj.to = message.to); + message.value !== undefined && (obj.value = message.value); + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array(0))); + if (message.accesses) { + obj.accesses = message.accesses.map((e) => e ? AccessTuple.toJSON(e) : undefined); + } else { + obj.accesses = []; + } + message.v !== undefined && (obj.v = base64FromBytes(message.v !== undefined ? message.v : new Uint8Array(0))); + message.r !== undefined && (obj.r = base64FromBytes(message.r !== undefined ? message.r : new Uint8Array(0))); + message.s !== undefined && (obj.s = base64FromBytes(message.s !== undefined ? message.s : new Uint8Array(0))); + return obj; + }, + + create, I>>(base?: I): DynamicFeeTx { + return DynamicFeeTx.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): DynamicFeeTx { + const message = createBaseDynamicFeeTx(); + message.chainId = object.chainId ?? ""; + message.nonce = (object.nonce !== undefined && object.nonce !== null) ? Long.fromValue(object.nonce) : Long.UZERO; + message.gasTipCap = object.gasTipCap ?? ""; + message.gasFeeCap = object.gasFeeCap ?? ""; + message.gas = (object.gas !== undefined && object.gas !== null) ? Long.fromValue(object.gas) : Long.UZERO; + message.to = object.to ?? ""; + message.value = object.value ?? ""; + message.data = object.data ?? new Uint8Array(0); + message.accesses = object.accesses?.map((e) => AccessTuple.fromPartial(e)) || []; + message.v = object.v ?? new Uint8Array(0); + message.r = object.r ?? new Uint8Array(0); + message.s = object.s ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseExtensionOptionsEthereumTx(): ExtensionOptionsEthereumTx { + return {}; +} + +export const ExtensionOptionsEthereumTx = { + encode(_: ExtensionOptionsEthereumTx, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionOptionsEthereumTx { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionOptionsEthereumTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): ExtensionOptionsEthereumTx { + return {}; + }, + + toJSON(_: ExtensionOptionsEthereumTx): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): ExtensionOptionsEthereumTx { + return ExtensionOptionsEthereumTx.fromPartial(base ?? {}); + }, + + fromPartial, I>>(_: I): ExtensionOptionsEthereumTx { + const message = createBaseExtensionOptionsEthereumTx(); + return message; + }, +}; + +function createBaseMsgEthereumTxResponse(): MsgEthereumTxResponse { + return { hash: "", logs: [], ret: new Uint8Array(0), vmError: "", gasUsed: Long.UZERO }; +} + +export const MsgEthereumTxResponse = { + encode(message: MsgEthereumTxResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.hash !== "") { + writer.uint32(10).string(message.hash); + } + for (const v of message.logs) { + Log.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.ret.length !== 0) { + writer.uint32(26).bytes(message.ret); + } + if (message.vmError !== "") { + writer.uint32(34).string(message.vmError); + } + if (!message.gasUsed.isZero()) { + writer.uint32(40).uint64(message.gasUsed); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgEthereumTxResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgEthereumTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.hash = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.logs.push(Log.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.ret = reader.bytes(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.vmError = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.gasUsed = reader.uint64() as Long; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgEthereumTxResponse { + return { + hash: isSet(object.hash) ? String(object.hash) : "", + logs: Array.isArray(object?.logs) ? object.logs.map((e: any) => Log.fromJSON(e)) : [], + ret: isSet(object.ret) ? bytesFromBase64(object.ret) : new Uint8Array(0), + vmError: isSet(object.vmError) ? String(object.vmError) : "", + gasUsed: isSet(object.gasUsed) ? Long.fromValue(object.gasUsed) : Long.UZERO, + }; + }, + + toJSON(message: MsgEthereumTxResponse): unknown { + const obj: any = {}; + message.hash !== undefined && (obj.hash = message.hash); + if (message.logs) { + obj.logs = message.logs.map((e) => e ? Log.toJSON(e) : undefined); + } else { + obj.logs = []; + } + message.ret !== undefined && + (obj.ret = base64FromBytes(message.ret !== undefined ? message.ret : new Uint8Array(0))); + message.vmError !== undefined && (obj.vmError = message.vmError); + message.gasUsed !== undefined && (obj.gasUsed = (message.gasUsed || Long.UZERO).toString()); + return obj; + }, + + create, I>>(base?: I): MsgEthereumTxResponse { + return MsgEthereumTxResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): MsgEthereumTxResponse { + const message = createBaseMsgEthereumTxResponse(); + message.hash = object.hash ?? ""; + message.logs = object.logs?.map((e) => Log.fromPartial(e)) || []; + message.ret = object.ret ?? new Uint8Array(0); + message.vmError = object.vmError ?? ""; + message.gasUsed = (object.gasUsed !== undefined && object.gasUsed !== null) + ? Long.fromValue(object.gasUsed) + : Long.UZERO; + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + message.authority !== undefined && (obj.authority = message.authority); + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + + create, I>>(base?: I): MsgUpdateParams { + return MsgUpdateParams.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +function createBaseMsgCreateFunToken(): MsgCreateFunToken { + return { fromErc20: "", fromBankDenom: "", sender: "" }; +} + +export const MsgCreateFunToken = { + encode(message: MsgCreateFunToken, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.fromErc20 !== "") { + writer.uint32(10).string(message.fromErc20); + } + if (message.fromBankDenom !== "") { + writer.uint32(18).string(message.fromBankDenom); + } + if (message.sender !== "") { + writer.uint32(26).string(message.sender); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateFunToken { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateFunToken(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.fromErc20 = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fromBankDenom = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.sender = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateFunToken { + return { + fromErc20: isSet(object.fromErc20) ? String(object.fromErc20) : "", + fromBankDenom: isSet(object.fromBankDenom) ? String(object.fromBankDenom) : "", + sender: isSet(object.sender) ? String(object.sender) : "", + }; + }, + + toJSON(message: MsgCreateFunToken): unknown { + const obj: any = {}; + message.fromErc20 !== undefined && (obj.fromErc20 = message.fromErc20); + message.fromBankDenom !== undefined && (obj.fromBankDenom = message.fromBankDenom); + message.sender !== undefined && (obj.sender = message.sender); + return obj; + }, + + create, I>>(base?: I): MsgCreateFunToken { + return MsgCreateFunToken.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): MsgCreateFunToken { + const message = createBaseMsgCreateFunToken(); + message.fromErc20 = object.fromErc20 ?? ""; + message.fromBankDenom = object.fromBankDenom ?? ""; + message.sender = object.sender ?? ""; + return message; + }, +}; + +function createBaseMsgCreateFunTokenResponse(): MsgCreateFunTokenResponse { + return { funtokenMapping: undefined }; +} + +export const MsgCreateFunTokenResponse = { + encode(message: MsgCreateFunTokenResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.funtokenMapping !== undefined) { + FunToken.encode(message.funtokenMapping, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateFunTokenResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateFunTokenResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.funtokenMapping = FunToken.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateFunTokenResponse { + return { funtokenMapping: isSet(object.funtokenMapping) ? FunToken.fromJSON(object.funtokenMapping) : undefined }; + }, + + toJSON(message: MsgCreateFunTokenResponse): unknown { + const obj: any = {}; + message.funtokenMapping !== undefined && + (obj.funtokenMapping = message.funtokenMapping ? FunToken.toJSON(message.funtokenMapping) : undefined); + return obj; + }, + + create, I>>(base?: I): MsgCreateFunTokenResponse { + return MsgCreateFunTokenResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): MsgCreateFunTokenResponse { + const message = createBaseMsgCreateFunTokenResponse(); + message.funtokenMapping = (object.funtokenMapping !== undefined && object.funtokenMapping !== null) + ? FunToken.fromPartial(object.funtokenMapping) + : undefined; + return message; + }, +}; + +function createBaseMsgConvertCoinToEvm(): MsgConvertCoinToEvm { + return { toEthAddr: "", sender: "", bankCoin: undefined }; +} + +export const MsgConvertCoinToEvm = { + encode(message: MsgConvertCoinToEvm, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.toEthAddr !== "") { + writer.uint32(10).string(message.toEthAddr); + } + if (message.sender !== "") { + writer.uint32(18).string(message.sender); + } + if (message.bankCoin !== undefined) { + Coin.encode(message.bankCoin, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgConvertCoinToEvm { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgConvertCoinToEvm(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.toEthAddr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.sender = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bankCoin = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgConvertCoinToEvm { + return { + toEthAddr: isSet(object.toEthAddr) ? String(object.toEthAddr) : "", + sender: isSet(object.sender) ? String(object.sender) : "", + bankCoin: isSet(object.bankCoin) ? Coin.fromJSON(object.bankCoin) : undefined, + }; + }, + + toJSON(message: MsgConvertCoinToEvm): unknown { + const obj: any = {}; + message.toEthAddr !== undefined && (obj.toEthAddr = message.toEthAddr); + message.sender !== undefined && (obj.sender = message.sender); + message.bankCoin !== undefined && (obj.bankCoin = message.bankCoin ? Coin.toJSON(message.bankCoin) : undefined); + return obj; + }, + + create, I>>(base?: I): MsgConvertCoinToEvm { + return MsgConvertCoinToEvm.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): MsgConvertCoinToEvm { + const message = createBaseMsgConvertCoinToEvm(); + message.toEthAddr = object.toEthAddr ?? ""; + message.sender = object.sender ?? ""; + message.bankCoin = (object.bankCoin !== undefined && object.bankCoin !== null) + ? Coin.fromPartial(object.bankCoin) + : undefined; + return message; + }, +}; + +function createBaseMsgConvertCoinToEvmResponse(): MsgConvertCoinToEvmResponse { + return {}; +} + +export const MsgConvertCoinToEvmResponse = { + encode(_: MsgConvertCoinToEvmResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgConvertCoinToEvmResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgConvertCoinToEvmResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgConvertCoinToEvmResponse { + return {}; + }, + + toJSON(_: MsgConvertCoinToEvmResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgConvertCoinToEvmResponse { + return MsgConvertCoinToEvmResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(_: I): MsgConvertCoinToEvmResponse { + const message = createBaseMsgConvertCoinToEvmResponse(); + return message; + }, +}; + +/** Msg defines the evm Msg service. */ +export interface Msg { + /** EthereumTx defines a method submitting Ethereum transactions. */ + EthereumTx(request: MsgEthereumTx): Promise; + /** + * UpdateParams defined a governance operation for updating the x/evm module + * parameters. The authority is hard-coded to the x/gov module account + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * CreateFunToken: Create a "FunToken" mapping. Either the ERC20 contract + * address can be given to create the mapping to a Bank Coin, or the + * denomination for a Bank Coin can be given to create the mapping to an ERC20. + */ + CreateFunToken(request: MsgCreateFunToken): Promise; + /** + * ConvertCoinToEvm: Sends a coin with a valid "FunToken" mapping to the + * given recipient address ("to_eth_addr") in the corresponding ERC20 + * representation. + */ + ConvertCoinToEvm(request: MsgConvertCoinToEvm): Promise; +} + +export const MsgServiceName = "eth.evm.v1.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.EthereumTx = this.EthereumTx.bind(this); + this.UpdateParams = this.UpdateParams.bind(this); + this.CreateFunToken = this.CreateFunToken.bind(this); + this.ConvertCoinToEvm = this.ConvertCoinToEvm.bind(this); + } + EthereumTx(request: MsgEthereumTx): Promise { + const data = MsgEthereumTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "EthereumTx", data); + return promise.then((data) => MsgEthereumTxResponse.decode(_m0.Reader.create(data))); + } + + UpdateParams(request: MsgUpdateParams): Promise { + const data = MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateParams", data); + return promise.then((data) => MsgUpdateParamsResponse.decode(_m0.Reader.create(data))); + } + + CreateFunToken(request: MsgCreateFunToken): Promise { + const data = MsgCreateFunToken.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateFunToken", data); + return promise.then((data) => MsgCreateFunTokenResponse.decode(_m0.Reader.create(data))); + } + + ConvertCoinToEvm(request: MsgConvertCoinToEvm): Promise { + const data = MsgConvertCoinToEvm.encode(request).finish(); + const promise = this.rpc.request(this.service, "ConvertCoinToEvm", data); + return promise.then((data) => MsgConvertCoinToEvmResponse.decode(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +declare var self: any | undefined; +declare var window: any | undefined; +declare var global: any | undefined; +var tsProtoGlobalThis: 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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (tsProtoGlobalThis.Buffer) { + return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + } else { + const bin = tsProtoGlobalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (tsProtoGlobalThis.Buffer) { + return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return tsProtoGlobalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/eth/types/v1/account.ts b/src/protojs/eth/types/v1/account.ts new file mode 100644 index 00000000..1638c5f1 --- /dev/null +++ b/src/protojs/eth/types/v1/account.ts @@ -0,0 +1,112 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { BaseAccount } from "../../../cosmos/auth/v1beta1/auth"; + +/** Copyright (c) 2023-2024 Nibi, Inc. */ + +/** + * EthAccount implements the authtypes.AccountI interface and embeds an + * authtypes.BaseAccount type. It is compatible with the auth AccountKeeper. + */ +export interface EthAccount { + /** base_account is an authtypes.BaseAccount */ + baseAccount?: BaseAccount; + /** code_hash is the hash calculated from the code contents */ + codeHash: string; +} + +function createBaseEthAccount(): EthAccount { + return { baseAccount: undefined, codeHash: "" }; +} + +export const EthAccount = { + encode(message: EthAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.baseAccount !== undefined) { + BaseAccount.encode(message.baseAccount, writer.uint32(10).fork()).ldelim(); + } + if (message.codeHash !== "") { + writer.uint32(18).string(message.codeHash); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EthAccount { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEthAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.baseAccount = BaseAccount.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.codeHash = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): EthAccount { + return { + baseAccount: isSet(object.baseAccount) ? BaseAccount.fromJSON(object.baseAccount) : undefined, + codeHash: isSet(object.codeHash) ? String(object.codeHash) : "", + }; + }, + + toJSON(message: EthAccount): unknown { + const obj: any = {}; + message.baseAccount !== undefined && + (obj.baseAccount = message.baseAccount ? BaseAccount.toJSON(message.baseAccount) : undefined); + message.codeHash !== undefined && (obj.codeHash = message.codeHash); + return obj; + }, + + create, I>>(base?: I): EthAccount { + return EthAccount.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): EthAccount { + const message = createBaseEthAccount(); + message.baseAccount = (object.baseAccount !== undefined && object.baseAccount !== null) + ? BaseAccount.fromPartial(object.baseAccount) + : undefined; + message.codeHash = object.codeHash ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/eth/types/v1/indexer.ts b/src/protojs/eth/types/v1/indexer.ts new file mode 100644 index 00000000..0977bf55 --- /dev/null +++ b/src/protojs/eth/types/v1/indexer.ts @@ -0,0 +1,208 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +/** Copyright (c) 2023-2024 Nibi, Inc. */ + +/** TxResult is the value stored in eth tx indexer */ +export interface TxResult { + /** height of the blockchain */ + height: Long; + /** + * tx_index is the index of the block transaction. It is not the index of an + * "internal transaction" + */ + txIndex: number; + /** msg_index in a batch transaction */ + msgIndex: number; + /** + * eth_tx_index is the index in the list of valid eth tx in the block. Said + * another way, it is the index of the transaction list returned by + * eth_getBlock API. + */ + ethTxIndex: number; + /** failed is true if the eth transaction did not succeed */ + failed: boolean; + /** + * gas_used by the transaction. If it exceeds the block gas limit, + * it's set to gas limit, which is what's actually deducted by ante handler. + */ + gasUsed: Long; + /** + * cumulative_gas_used specifies the cumulated amount of gas used for all + * processed messages within the current batch transaction. + */ + cumulativeGasUsed: Long; +} + +function createBaseTxResult(): TxResult { + return { + height: Long.ZERO, + txIndex: 0, + msgIndex: 0, + ethTxIndex: 0, + failed: false, + gasUsed: Long.UZERO, + cumulativeGasUsed: Long.UZERO, + }; +} + +export const TxResult = { + encode(message: TxResult, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (!message.height.isZero()) { + writer.uint32(8).int64(message.height); + } + if (message.txIndex !== 0) { + writer.uint32(16).uint32(message.txIndex); + } + if (message.msgIndex !== 0) { + writer.uint32(24).uint32(message.msgIndex); + } + if (message.ethTxIndex !== 0) { + writer.uint32(32).int32(message.ethTxIndex); + } + if (message.failed === true) { + writer.uint32(40).bool(message.failed); + } + if (!message.gasUsed.isZero()) { + writer.uint32(48).uint64(message.gasUsed); + } + if (!message.cumulativeGasUsed.isZero()) { + writer.uint32(56).uint64(message.cumulativeGasUsed); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TxResult { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = reader.int64() as Long; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.txIndex = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.msgIndex = reader.uint32(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.ethTxIndex = reader.int32(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.failed = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.gasUsed = reader.uint64() as Long; + continue; + case 7: + if (tag !== 56) { + break; + } + + message.cumulativeGasUsed = reader.uint64() as Long; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxResult { + return { + height: isSet(object.height) ? Long.fromValue(object.height) : Long.ZERO, + txIndex: isSet(object.txIndex) ? Number(object.txIndex) : 0, + msgIndex: isSet(object.msgIndex) ? Number(object.msgIndex) : 0, + ethTxIndex: isSet(object.ethTxIndex) ? Number(object.ethTxIndex) : 0, + failed: isSet(object.failed) ? Boolean(object.failed) : false, + gasUsed: isSet(object.gasUsed) ? Long.fromValue(object.gasUsed) : Long.UZERO, + cumulativeGasUsed: isSet(object.cumulativeGasUsed) ? Long.fromValue(object.cumulativeGasUsed) : Long.UZERO, + }; + }, + + toJSON(message: TxResult): unknown { + const obj: any = {}; + message.height !== undefined && (obj.height = (message.height || Long.ZERO).toString()); + message.txIndex !== undefined && (obj.txIndex = Math.round(message.txIndex)); + message.msgIndex !== undefined && (obj.msgIndex = Math.round(message.msgIndex)); + message.ethTxIndex !== undefined && (obj.ethTxIndex = Math.round(message.ethTxIndex)); + message.failed !== undefined && (obj.failed = message.failed); + message.gasUsed !== undefined && (obj.gasUsed = (message.gasUsed || Long.UZERO).toString()); + message.cumulativeGasUsed !== undefined && + (obj.cumulativeGasUsed = (message.cumulativeGasUsed || Long.UZERO).toString()); + return obj; + }, + + create, I>>(base?: I): TxResult { + return TxResult.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): TxResult { + const message = createBaseTxResult(); + message.height = (object.height !== undefined && object.height !== null) + ? Long.fromValue(object.height) + : Long.ZERO; + message.txIndex = object.txIndex ?? 0; + message.msgIndex = object.msgIndex ?? 0; + message.ethTxIndex = object.ethTxIndex ?? 0; + message.failed = object.failed ?? false; + message.gasUsed = (object.gasUsed !== undefined && object.gasUsed !== null) + ? Long.fromValue(object.gasUsed) + : Long.UZERO; + message.cumulativeGasUsed = (object.cumulativeGasUsed !== undefined && object.cumulativeGasUsed !== null) + ? Long.fromValue(object.cumulativeGasUsed) + : Long.UZERO; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/google/api/http.ts b/src/protojs/google/api/http.ts new file mode 100644 index 00000000..e7204dea --- /dev/null +++ b/src/protojs/google/api/http.ts @@ -0,0 +1,731 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +/** + * 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 parameters 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. + */ + fullyDecodeReservedExpansion: boolean; +} + +/** + * # gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; + * } + * } + * message GetMessageRequest { + * string name = 1; // Mapped to URL path. + * } + * message Message { + * string text = 1; // The resource content. + * } + * + * This enables an HTTP REST to gRPC mapping as below: + * + * HTTP | gRPC + * -----|----- + * `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")` + * + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: + * + * 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 URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. + * } + * + * This enables a HTTP JSON to RPC mapping as below: + * + * HTTP | gRPC + * -----|----- + * `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 URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. + * + * For HTTP methods that 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) = { + * patch: "/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 | gRPC + * -----|----- + * `PATCH /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) = { + * patch: "/v1/messages/{message_id}" + * body: "*" + * }; + * } + * } + * message Message { + * string message_id = 1; + * string text = 2; + * } + * + * The following HTTP JSON to RPC mapping is enabled: + * + * HTTP | gRPC + * -----|----- + * `PATCH /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 when + * 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 | gRPC + * -----|----- + * `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 + * + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP request body, all + * fields are passed via URL path and URL query parameters. + * + * ### Path template syntax + * + * Template = "/" Segments [ Verb ] ; + * Segments = Segment { "/" Segment } ; + * Segment = "*" | "**" | LITERAL | Variable ; + * Variable = "{" FieldPath [ "=" Segments ] "}" ; + * FieldPath = IDENT { "." IDENT } ; + * Verb = ":" LITERAL ; + * + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. + * + * 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=*}`. + * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * + * If a variable contains exactly one path segment, such as `"{var}"` or + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * ## Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * Example: + * + * http: + * rules: + * # Selects a gRPC method and applies HttpRule to it. + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * ## Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion + * does not expand special characters like `?` and `#`, which would lead + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. + * + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. + * + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. + */ +export interface HttpRule { + /** + * Selects a method to which this rule applies. + * + * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + */ + selector: string; + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ + get?: + | string + | undefined; + /** Maps to HTTP PUT. Used for replacing a resource. */ + put?: + | string + | undefined; + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ + post?: + | string + | undefined; + /** Maps to HTTP DELETE. Used for deleting a resource. */ + delete?: + | string + | undefined; + /** Maps to HTTP PATCH. 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 request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. + */ + body: string; + /** + * Optional. The name of the response field whose value is mapped to the HTTP + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. + */ + responseBody: 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). + */ + additionalBindings: 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; +} + +function createBaseHttp(): Http { + return { rules: [], fullyDecodeReservedExpansion: false }; +} + +export const Http = { + encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.rules) { + HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.fullyDecodeReservedExpansion === true) { + writer.uint32(16).bool(message.fullyDecodeReservedExpansion); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Http { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHttp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.rules.push(HttpRule.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.fullyDecodeReservedExpansion = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Http { + return { + rules: Array.isArray(object?.rules) ? object.rules.map((e: any) => HttpRule.fromJSON(e)) : [], + fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) + ? Boolean(object.fullyDecodeReservedExpansion) + : false, + }; + }, + + 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.fullyDecodeReservedExpansion !== undefined && + (obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion); + return obj; + }, + + create, I>>(base?: I): Http { + return Http.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): Http { + const message = createBaseHttp(); + message.rules = object.rules?.map((e) => HttpRule.fromPartial(e)) || []; + message.fullyDecodeReservedExpansion = object.fullyDecodeReservedExpansion ?? false; + return message; + }, +}; + +function createBaseHttpRule(): HttpRule { + return { + selector: "", + get: undefined, + put: undefined, + post: undefined, + delete: undefined, + patch: undefined, + custom: undefined, + body: "", + responseBody: "", + additionalBindings: [], + }; +} + +export const HttpRule = { + encode(message: HttpRule, writer: _m0.Writer = _m0.Writer.create()): _m0.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.responseBody !== "") { + writer.uint32(98).string(message.responseBody); + } + for (const v of message.additionalBindings) { + HttpRule.encode(v!, writer.uint32(90).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHttpRule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.selector = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.get = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.put = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.post = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.delete = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.patch = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.custom = CustomHttpPattern.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.body = reader.string(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.responseBody = reader.string(); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.additionalBindings.push(HttpRule.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): HttpRule { + return { + selector: isSet(object.selector) ? String(object.selector) : "", + get: isSet(object.get) ? String(object.get) : undefined, + put: isSet(object.put) ? String(object.put) : undefined, + post: isSet(object.post) ? String(object.post) : undefined, + delete: isSet(object.delete) ? String(object.delete) : undefined, + patch: isSet(object.patch) ? String(object.patch) : undefined, + custom: isSet(object.custom) ? CustomHttpPattern.fromJSON(object.custom) : undefined, + body: isSet(object.body) ? String(object.body) : "", + responseBody: isSet(object.responseBody) ? String(object.responseBody) : "", + additionalBindings: Array.isArray(object?.additionalBindings) + ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) + : [], + }; + }, + + 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.responseBody !== undefined && (obj.responseBody = message.responseBody); + if (message.additionalBindings) { + obj.additionalBindings = message.additionalBindings.map((e) => e ? HttpRule.toJSON(e) : undefined); + } else { + obj.additionalBindings = []; + } + return obj; + }, + + create, I>>(base?: I): HttpRule { + return HttpRule.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): HttpRule { + const message = createBaseHttpRule(); + message.selector = object.selector ?? ""; + message.get = object.get ?? undefined; + message.put = object.put ?? undefined; + message.post = object.post ?? undefined; + message.delete = object.delete ?? undefined; + message.patch = object.patch ?? undefined; + message.custom = (object.custom !== undefined && object.custom !== null) + ? CustomHttpPattern.fromPartial(object.custom) + : undefined; + message.body = object.body ?? ""; + message.responseBody = object.responseBody ?? ""; + message.additionalBindings = object.additionalBindings?.map((e) => HttpRule.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseCustomHttpPattern(): CustomHttpPattern { + return { kind: "", path: "" }; +} + +export const CustomHttpPattern = { + encode(message: CustomHttpPattern, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.kind !== "") { + writer.uint32(10).string(message.kind); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCustomHttpPattern(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.kind = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.path = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): CustomHttpPattern { + return { kind: isSet(object.kind) ? String(object.kind) : "", path: isSet(object.path) ? String(object.path) : "" }; + }, + + toJSON(message: CustomHttpPattern): unknown { + const obj: any = {}; + message.kind !== undefined && (obj.kind = message.kind); + message.path !== undefined && (obj.path = message.path); + return obj; + }, + + create, I>>(base?: I): CustomHttpPattern { + return CustomHttpPattern.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): CustomHttpPattern { + const message = createBaseCustomHttpPattern(); + message.kind = object.kind ?? ""; + message.path = object.path ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/google/protobuf/any.ts b/src/protojs/google/protobuf/any.ts new file mode 100644 index 00000000..80d3d749 --- /dev/null +++ b/src/protojs/google/protobuf/any.ts @@ -0,0 +1,263 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +/** + * `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); + * } + * // or ... + * if (any.isSameTypeAs(Foo.getDefaultInstance())) { + * foo = any.unpack(Foo.getDefaultInstance()); + * } + * + * 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": , + * "lastName": + * } + * + * 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. As of May 2023, there are no widely used type server + * implementations and no plans to implement one. + * + * Schemes other than `http`, `https` (or the empty scheme) might be + * used with implementation specific semantics. + */ + typeUrl: string; + /** Must be a valid serialized protocol buffer of the above specified type. */ + value: Uint8Array; +} + +function createBaseAny(): Any { + return { typeUrl: "", value: new Uint8Array(0) }; +} + +export const Any = { + encode(message: Any, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.typeUrl !== "") { + writer.uint32(10).string(message.typeUrl); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Any { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAny(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.typeUrl = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Any { + return { + typeUrl: isSet(object.typeUrl) ? String(object.typeUrl) : "", + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + }; + }, + + toJSON(message: Any): unknown { + const obj: any = {}; + message.typeUrl !== undefined && (obj.typeUrl = message.typeUrl); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array(0))); + return obj; + }, + + create, I>>(base?: I): Any { + return Any.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): Any { + const message = createBaseAny(); + message.typeUrl = object.typeUrl ?? ""; + message.value = object.value ?? new Uint8Array(0); + return message; + }, +}; + +declare var self: any | undefined; +declare var window: any | undefined; +declare var global: any | undefined; +var tsProtoGlobalThis: 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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (tsProtoGlobalThis.Buffer) { + return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + } else { + const bin = tsProtoGlobalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (tsProtoGlobalThis.Buffer) { + return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return tsProtoGlobalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/google/protobuf/duration.ts b/src/protojs/google/protobuf/duration.ts new file mode 100644 index 00000000..35be9533 --- /dev/null +++ b/src/protojs/google/protobuf/duration.ts @@ -0,0 +1,175 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +/** + * A Duration represents a signed, fixed-length span of time represented + * as a count of seconds and fractions of seconds at nanosecond + * resolution. It is independent of any calendar and concepts like "day" + * or "month". It is related to Timestamp in that the difference between + * two Timestamp values is a Duration and it can be added or subtracted + * from a Timestamp. Range is approximately +-10,000 years. + * + * # Examples + * + * Example 1: Compute Duration from two Timestamps in pseudo code. + * + * Timestamp start = ...; + * Timestamp end = ...; + * Duration duration = ...; + * + * duration.seconds = end.seconds - start.seconds; + * duration.nanos = end.nanos - start.nanos; + * + * if (duration.seconds < 0 && duration.nanos > 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (duration.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + */ +export interface Duration { + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + */ + seconds: Long; + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + */ + nanos: number; +} + +function createBaseDuration(): Duration { + return { seconds: Long.ZERO, nanos: 0 }; +} + +export const Duration = { + encode(message: Duration, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (!message.seconds.isZero()) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Duration { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.seconds = reader.int64() as Long; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.nanos = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Duration { + return { + seconds: isSet(object.seconds) ? Long.fromValue(object.seconds) : Long.ZERO, + nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + }; + }, + + toJSON(message: Duration): unknown { + const obj: any = {}; + message.seconds !== undefined && (obj.seconds = (message.seconds || Long.ZERO).toString()); + message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); + return obj; + }, + + create, I>>(base?: I): Duration { + return Duration.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): Duration { + const message = createBaseDuration(); + message.seconds = (object.seconds !== undefined && object.seconds !== null) + ? Long.fromValue(object.seconds) + : Long.ZERO; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/google/protobuf/timestamp.ts b/src/protojs/google/protobuf/timestamp.ts new file mode 100644 index 00000000..32afffd1 --- /dev/null +++ b/src/protojs/google/protobuf/timestamp.ts @@ -0,0 +1,204 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +/** + * 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://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime() + * ) 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: Long; + /** + * 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; +} + +function createBaseTimestamp(): Timestamp { + return { seconds: Long.ZERO, nanos: 0 }; +} + +export const Timestamp = { + encode(message: Timestamp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (!message.seconds.isZero()) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Timestamp { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTimestamp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.seconds = reader.int64() as Long; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.nanos = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Timestamp { + return { + seconds: isSet(object.seconds) ? Long.fromValue(object.seconds) : Long.ZERO, + nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + }; + }, + + toJSON(message: Timestamp): unknown { + const obj: any = {}; + message.seconds !== undefined && (obj.seconds = (message.seconds || Long.ZERO).toString()); + message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); + return obj; + }, + + create, I>>(base?: I): Timestamp { + return Timestamp.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): Timestamp { + const message = createBaseTimestamp(); + message.seconds = (object.seconds !== undefined && object.seconds !== null) + ? Long.fromValue(object.seconds) + : Long.ZERO; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/index.cosmos.auth.ts b/src/protojs/index.cosmos.auth.ts new file mode 100644 index 00000000..8d76e8e4 --- /dev/null +++ b/src/protojs/index.cosmos.auth.ts @@ -0,0 +1,3 @@ +/* eslint-disable */ + +export * as v1beta1 from "./index.cosmos.auth.v1beta1"; diff --git a/src/protojs/index.cosmos.auth.v1beta1.ts b/src/protojs/index.cosmos.auth.v1beta1.ts new file mode 100644 index 00000000..977f61e1 --- /dev/null +++ b/src/protojs/index.cosmos.auth.v1beta1.ts @@ -0,0 +1,3 @@ +/* eslint-disable */ + +export * from "./cosmos/auth/v1beta1/auth"; diff --git a/src/protojs/index.cosmos.bank.ts b/src/protojs/index.cosmos.bank.ts new file mode 100644 index 00000000..6e6afd51 --- /dev/null +++ b/src/protojs/index.cosmos.bank.ts @@ -0,0 +1,3 @@ +/* eslint-disable */ + +export * as v1beta1 from "./index.cosmos.bank.v1beta1"; diff --git a/src/protojs/index.cosmos.bank.v1beta1.ts b/src/protojs/index.cosmos.bank.v1beta1.ts new file mode 100644 index 00000000..c6ae2c09 --- /dev/null +++ b/src/protojs/index.cosmos.bank.v1beta1.ts @@ -0,0 +1,3 @@ +/* eslint-disable */ + +export * from "./cosmos/bank/v1beta1/bank"; diff --git a/src/protojs/index.cosmos.base.query.ts b/src/protojs/index.cosmos.base.query.ts new file mode 100644 index 00000000..e68b936a --- /dev/null +++ b/src/protojs/index.cosmos.base.query.ts @@ -0,0 +1,3 @@ +/* eslint-disable */ + +export * as v1beta1 from "./index.cosmos.base.query.v1beta1"; diff --git a/src/protojs/index.cosmos.base.query.v1beta1.ts b/src/protojs/index.cosmos.base.query.v1beta1.ts new file mode 100644 index 00000000..e4d63a35 --- /dev/null +++ b/src/protojs/index.cosmos.base.query.v1beta1.ts @@ -0,0 +1,3 @@ +/* eslint-disable */ + +export * from "./cosmos/base/query/v1beta1/pagination"; diff --git a/src/protojs/index.cosmos.base.ts b/src/protojs/index.cosmos.base.ts new file mode 100644 index 00000000..897dbd1c --- /dev/null +++ b/src/protojs/index.cosmos.base.ts @@ -0,0 +1,3 @@ +/* eslint-disable */ + +export * as v1beta1 from "./index.cosmos.base.v1beta1"; diff --git a/src/protojs/index.cosmos.base.v1beta1.ts b/src/protojs/index.cosmos.base.v1beta1.ts new file mode 100644 index 00000000..ea5040f3 --- /dev/null +++ b/src/protojs/index.cosmos.base.v1beta1.ts @@ -0,0 +1,3 @@ +/* eslint-disable */ + +export * from "./cosmos/base/v1beta1/coin"; diff --git a/src/protojs/index.cosmos.ts b/src/protojs/index.cosmos.ts new file mode 100644 index 00000000..47d6f110 --- /dev/null +++ b/src/protojs/index.cosmos.ts @@ -0,0 +1,5 @@ +/* eslint-disable */ + +export * as base from "./index.cosmos.base"; + +export * as bank from "./index.cosmos.bank"; diff --git a/src/protojs/index.cosmos_proto.ts b/src/protojs/index.cosmos_proto.ts new file mode 100644 index 00000000..74998ca7 --- /dev/null +++ b/src/protojs/index.cosmos_proto.ts @@ -0,0 +1,3 @@ +/* eslint-disable */ + +export * from "./cosmos_proto/cosmos"; diff --git a/src/protojs/index.eth.evm.ts b/src/protojs/index.eth.evm.ts new file mode 100644 index 00000000..e80fb393 --- /dev/null +++ b/src/protojs/index.eth.evm.ts @@ -0,0 +1,3 @@ +/* eslint-disable */ + +export * as v1 from "./index.eth.evm.v1"; diff --git a/src/protojs/index.eth.evm.v1.ts b/src/protojs/index.eth.evm.v1.ts new file mode 100644 index 00000000..4e16621b --- /dev/null +++ b/src/protojs/index.eth.evm.v1.ts @@ -0,0 +1,4 @@ +/* eslint-disable */ + +export * from "./eth/evm/v1/evm"; +export * from "./eth/evm/v1/tx"; diff --git a/src/protojs/index.eth.ts b/src/protojs/index.eth.ts new file mode 100644 index 00000000..0931ae75 --- /dev/null +++ b/src/protojs/index.eth.ts @@ -0,0 +1,3 @@ +/* eslint-disable */ + +export * as types from "./index.eth.types"; diff --git a/src/protojs/index.eth.types.ts b/src/protojs/index.eth.types.ts new file mode 100644 index 00000000..c444b701 --- /dev/null +++ b/src/protojs/index.eth.types.ts @@ -0,0 +1,3 @@ +/* eslint-disable */ + +export * as v1 from "./index.eth.types.v1"; diff --git a/src/protojs/index.eth.types.v1.ts b/src/protojs/index.eth.types.v1.ts new file mode 100644 index 00000000..8230881f --- /dev/null +++ b/src/protojs/index.eth.types.v1.ts @@ -0,0 +1,3 @@ +/* eslint-disable */ + +export * from "./eth/types/v1/indexer"; diff --git a/src/protojs/index.google.api.ts b/src/protojs/index.google.api.ts new file mode 100644 index 00000000..c3654365 --- /dev/null +++ b/src/protojs/index.google.api.ts @@ -0,0 +1,4 @@ +/* eslint-disable */ + +export * from "./google/api/http"; + diff --git a/src/protojs/index.google.ts b/src/protojs/index.google.ts new file mode 100644 index 00000000..2e880f89 --- /dev/null +++ b/src/protojs/index.google.ts @@ -0,0 +1,3 @@ +/* eslint-disable */ + + diff --git a/src/protojs/index.nibiru.devgas.ts b/src/protojs/index.nibiru.devgas.ts new file mode 100644 index 00000000..a176d1f8 --- /dev/null +++ b/src/protojs/index.nibiru.devgas.ts @@ -0,0 +1,3 @@ +/* eslint-disable */ + +export * as v1 from "./index.nibiru.devgas.v1"; diff --git a/src/protojs/index.nibiru.devgas.v1.ts b/src/protojs/index.nibiru.devgas.v1.ts new file mode 100644 index 00000000..c4ebcfe0 --- /dev/null +++ b/src/protojs/index.nibiru.devgas.v1.ts @@ -0,0 +1,5 @@ +/* eslint-disable */ + +export * from "./nibiru/devgas/v1/devgas"; +export * from "./nibiru/devgas/v1/genesis"; +export * from "./nibiru/devgas/v1/tx"; diff --git a/src/protojs/index.nibiru.epochs.ts b/src/protojs/index.nibiru.epochs.ts new file mode 100644 index 00000000..4c907966 --- /dev/null +++ b/src/protojs/index.nibiru.epochs.ts @@ -0,0 +1,3 @@ +/* eslint-disable */ + +export * as v1 from "./index.nibiru.epochs.v1"; diff --git a/src/protojs/index.nibiru.epochs.v1.ts b/src/protojs/index.nibiru.epochs.v1.ts new file mode 100644 index 00000000..b814312d --- /dev/null +++ b/src/protojs/index.nibiru.epochs.v1.ts @@ -0,0 +1,3 @@ +/* eslint-disable */ + +export * from "./nibiru/epochs/v1/state"; diff --git a/src/protojs/index.nibiru.genmsg.ts b/src/protojs/index.nibiru.genmsg.ts new file mode 100644 index 00000000..7bf157e8 --- /dev/null +++ b/src/protojs/index.nibiru.genmsg.ts @@ -0,0 +1,3 @@ +/* eslint-disable */ + +export * as v1 from "./index.nibiru.genmsg.v1"; diff --git a/src/protojs/index.nibiru.genmsg.v1.ts b/src/protojs/index.nibiru.genmsg.v1.ts new file mode 100644 index 00000000..ec54462e --- /dev/null +++ b/src/protojs/index.nibiru.genmsg.v1.ts @@ -0,0 +1,3 @@ +/* eslint-disable */ + +export * from "./nibiru/genmsg/v1/genmsg"; diff --git a/src/protojs/index.nibiru.inflation.ts b/src/protojs/index.nibiru.inflation.ts new file mode 100644 index 00000000..9ec37d2f --- /dev/null +++ b/src/protojs/index.nibiru.inflation.ts @@ -0,0 +1,3 @@ +/* eslint-disable */ + +export * as v1 from "./index.nibiru.inflation.v1"; diff --git a/src/protojs/index.nibiru.inflation.v1.ts b/src/protojs/index.nibiru.inflation.v1.ts new file mode 100644 index 00000000..fe47db74 --- /dev/null +++ b/src/protojs/index.nibiru.inflation.v1.ts @@ -0,0 +1,4 @@ +/* eslint-disable */ + +export * from "./nibiru/inflation/v1/inflation"; +export * from "./nibiru/inflation/v1/tx"; diff --git a/src/protojs/index.nibiru.oracle.ts b/src/protojs/index.nibiru.oracle.ts new file mode 100644 index 00000000..a14a2223 --- /dev/null +++ b/src/protojs/index.nibiru.oracle.ts @@ -0,0 +1,3 @@ +/* eslint-disable */ + +export * as v1 from "./index.nibiru.oracle.v1"; diff --git a/src/protojs/index.nibiru.oracle.v1.ts b/src/protojs/index.nibiru.oracle.v1.ts new file mode 100644 index 00000000..62f33089 --- /dev/null +++ b/src/protojs/index.nibiru.oracle.v1.ts @@ -0,0 +1,4 @@ +/* eslint-disable */ + +export * from "./nibiru/oracle/v1/oracle"; +export * from "./nibiru/oracle/v1/tx"; diff --git a/src/protojs/index.nibiru.sudo.ts b/src/protojs/index.nibiru.sudo.ts new file mode 100644 index 00000000..2c967a8a --- /dev/null +++ b/src/protojs/index.nibiru.sudo.ts @@ -0,0 +1,3 @@ +/* eslint-disable */ + +export * as v1 from "./index.nibiru.sudo.v1"; diff --git a/src/protojs/index.nibiru.sudo.v1.ts b/src/protojs/index.nibiru.sudo.v1.ts new file mode 100644 index 00000000..a58d6c45 --- /dev/null +++ b/src/protojs/index.nibiru.sudo.v1.ts @@ -0,0 +1,3 @@ +/* eslint-disable */ + +export * from "./nibiru/sudo/v1/tx"; diff --git a/src/protojs/index.nibiru.tokenfactory.ts b/src/protojs/index.nibiru.tokenfactory.ts new file mode 100644 index 00000000..000edf2f --- /dev/null +++ b/src/protojs/index.nibiru.tokenfactory.ts @@ -0,0 +1,3 @@ +/* eslint-disable */ + +export * as v1 from "./index.nibiru.tokenfactory.v1"; diff --git a/src/protojs/index.nibiru.tokenfactory.v1.ts b/src/protojs/index.nibiru.tokenfactory.v1.ts new file mode 100644 index 00000000..ec2bd889 --- /dev/null +++ b/src/protojs/index.nibiru.tokenfactory.v1.ts @@ -0,0 +1,4 @@ +/* eslint-disable */ + +export * from "./nibiru/tokenfactory/v1/state"; +export * from "./nibiru/tokenfactory/v1/tx"; diff --git a/src/protojs/index.nibiru.ts b/src/protojs/index.nibiru.ts new file mode 100644 index 00000000..4a088a30 --- /dev/null +++ b/src/protojs/index.nibiru.ts @@ -0,0 +1,3 @@ +/* eslint-disable */ + +export * as tokenfactory from "./index.nibiru.tokenfactory"; diff --git a/src/protojs/index.ts b/src/protojs/index.ts new file mode 100644 index 00000000..5147d661 --- /dev/null +++ b/src/protojs/index.ts @@ -0,0 +1,8 @@ +/* eslint-disable */ + + + +export * as cosmos_proto from "./index.cosmos_proto"; + +export * as cosmos from "./index.cosmos"; +export * as nibiru from "./index.nibiru"; diff --git a/src/protojs/nibiru/devgas/v1/devgas.ts b/src/protojs/nibiru/devgas/v1/devgas.ts new file mode 100644 index 00000000..afe663c1 --- /dev/null +++ b/src/protojs/nibiru/devgas/v1/devgas.ts @@ -0,0 +1,130 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +/** + * FeeShare defines an instance that organizes fee distribution conditions for + * the owner of a given smart contract + */ +export interface FeeShare { + /** + * contract_address is the bech32 address of a registered contract in string + * form + */ + contractAddress: string; + /** + * deployer_address is the bech32 address of message sender. It must be the + * same as the contracts admin address. + */ + deployerAddress: string; + /** + * withdrawer_address is the bech32 address of account receiving the + * transaction fees. + */ + withdrawerAddress: string; +} + +function createBaseFeeShare(): FeeShare { + return { contractAddress: "", deployerAddress: "", withdrawerAddress: "" }; +} + +export const FeeShare = { + encode(message: FeeShare, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.contractAddress !== "") { + writer.uint32(10).string(message.contractAddress); + } + if (message.deployerAddress !== "") { + writer.uint32(18).string(message.deployerAddress); + } + if (message.withdrawerAddress !== "") { + writer.uint32(26).string(message.withdrawerAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): FeeShare { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeeShare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.deployerAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.withdrawerAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeeShare { + return { + contractAddress: isSet(object.contractAddress) ? String(object.contractAddress) : "", + deployerAddress: isSet(object.deployerAddress) ? String(object.deployerAddress) : "", + withdrawerAddress: isSet(object.withdrawerAddress) ? String(object.withdrawerAddress) : "", + }; + }, + + toJSON(message: FeeShare): unknown { + const obj: any = {}; + message.contractAddress !== undefined && (obj.contractAddress = message.contractAddress); + message.deployerAddress !== undefined && (obj.deployerAddress = message.deployerAddress); + message.withdrawerAddress !== undefined && (obj.withdrawerAddress = message.withdrawerAddress); + return obj; + }, + + create, I>>(base?: I): FeeShare { + return FeeShare.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): FeeShare { + const message = createBaseFeeShare(); + message.contractAddress = object.contractAddress ?? ""; + message.deployerAddress = object.deployerAddress ?? ""; + message.withdrawerAddress = object.withdrawerAddress ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/nibiru/devgas/v1/event.ts b/src/protojs/nibiru/devgas/v1/event.ts new file mode 100644 index 00000000..617181f6 --- /dev/null +++ b/src/protojs/nibiru/devgas/v1/event.ts @@ -0,0 +1,390 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +/** + * ABCI event emitted when a deployer registers a contract to receive fee + * sharing payouts, specifying the deployer, contract, and withdrawer addresses. + */ +export interface EventRegisterDevGas { + /** + * deployer is the addess of the account that registered the smart contract to + * receive dev gas royalties. + */ + deployer: string; + /** + * Address of the smart contract. This identifies the specific contract + * that will receive fee sharing payouts. + */ + contract: string; + /** + * The address that will receive the fee sharing payouts for the registered + * contract. This could be the deployer address or a separate withdrawer + * address specified. + */ + withdrawer: string; +} + +/** + * ABCI event emitted when a deployer cancels fee sharing for a contract, + * specifying the deployer and contract addresses. + */ +export interface EventCancelDevGas { + /** + * deployer is the addess of the account that registered the smart contract to + * receive dev gas royalties. + */ + deployer: string; + /** + * Address of the smart contract. This identifies the specific contract + * that will receive fee sharing payouts. + */ + contract: string; +} + +/** + * ABCI event emitted when a deployer updates the fee sharing registration for a + * contract, specifying updated deployer, contract, and/or withdrawer addresses. + */ +export interface EventUpdateDevGas { + /** + * deployer is the addess of the account that registered the smart contract to + * receive dev gas royalties. + */ + deployer: string; + /** + * Address of the smart contract. This identifies the specific contract + * that will receive fee sharing payouts. + */ + contract: string; + /** + * The address that will receive the fee sharing payouts for the registered + * contract. This could be the deployer address or a separate withdrawer + * address specified. + */ + withdrawer: string; +} + +/** + * ABCI event emitted when fee sharing payouts are made, containing details on + * the payouts in JSON format. + */ +export interface EventPayoutDevGas { + payouts: string; +} + +function createBaseEventRegisterDevGas(): EventRegisterDevGas { + return { deployer: "", contract: "", withdrawer: "" }; +} + +export const EventRegisterDevGas = { + encode(message: EventRegisterDevGas, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.deployer !== "") { + writer.uint32(10).string(message.deployer); + } + if (message.contract !== "") { + writer.uint32(18).string(message.contract); + } + if (message.withdrawer !== "") { + writer.uint32(26).string(message.withdrawer); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventRegisterDevGas { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventRegisterDevGas(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.deployer = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contract = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.withdrawer = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventRegisterDevGas { + return { + deployer: isSet(object.deployer) ? String(object.deployer) : "", + contract: isSet(object.contract) ? String(object.contract) : "", + withdrawer: isSet(object.withdrawer) ? String(object.withdrawer) : "", + }; + }, + + toJSON(message: EventRegisterDevGas): unknown { + const obj: any = {}; + message.deployer !== undefined && (obj.deployer = message.deployer); + message.contract !== undefined && (obj.contract = message.contract); + message.withdrawer !== undefined && (obj.withdrawer = message.withdrawer); + return obj; + }, + + create, I>>(base?: I): EventRegisterDevGas { + return EventRegisterDevGas.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): EventRegisterDevGas { + const message = createBaseEventRegisterDevGas(); + message.deployer = object.deployer ?? ""; + message.contract = object.contract ?? ""; + message.withdrawer = object.withdrawer ?? ""; + return message; + }, +}; + +function createBaseEventCancelDevGas(): EventCancelDevGas { + return { deployer: "", contract: "" }; +} + +export const EventCancelDevGas = { + encode(message: EventCancelDevGas, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.deployer !== "") { + writer.uint32(10).string(message.deployer); + } + if (message.contract !== "") { + writer.uint32(18).string(message.contract); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventCancelDevGas { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventCancelDevGas(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.deployer = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contract = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventCancelDevGas { + return { + deployer: isSet(object.deployer) ? String(object.deployer) : "", + contract: isSet(object.contract) ? String(object.contract) : "", + }; + }, + + toJSON(message: EventCancelDevGas): unknown { + const obj: any = {}; + message.deployer !== undefined && (obj.deployer = message.deployer); + message.contract !== undefined && (obj.contract = message.contract); + return obj; + }, + + create, I>>(base?: I): EventCancelDevGas { + return EventCancelDevGas.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): EventCancelDevGas { + const message = createBaseEventCancelDevGas(); + message.deployer = object.deployer ?? ""; + message.contract = object.contract ?? ""; + return message; + }, +}; + +function createBaseEventUpdateDevGas(): EventUpdateDevGas { + return { deployer: "", contract: "", withdrawer: "" }; +} + +export const EventUpdateDevGas = { + encode(message: EventUpdateDevGas, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.deployer !== "") { + writer.uint32(10).string(message.deployer); + } + if (message.contract !== "") { + writer.uint32(18).string(message.contract); + } + if (message.withdrawer !== "") { + writer.uint32(26).string(message.withdrawer); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventUpdateDevGas { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventUpdateDevGas(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.deployer = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contract = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.withdrawer = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventUpdateDevGas { + return { + deployer: isSet(object.deployer) ? String(object.deployer) : "", + contract: isSet(object.contract) ? String(object.contract) : "", + withdrawer: isSet(object.withdrawer) ? String(object.withdrawer) : "", + }; + }, + + toJSON(message: EventUpdateDevGas): unknown { + const obj: any = {}; + message.deployer !== undefined && (obj.deployer = message.deployer); + message.contract !== undefined && (obj.contract = message.contract); + message.withdrawer !== undefined && (obj.withdrawer = message.withdrawer); + return obj; + }, + + create, I>>(base?: I): EventUpdateDevGas { + return EventUpdateDevGas.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): EventUpdateDevGas { + const message = createBaseEventUpdateDevGas(); + message.deployer = object.deployer ?? ""; + message.contract = object.contract ?? ""; + message.withdrawer = object.withdrawer ?? ""; + return message; + }, +}; + +function createBaseEventPayoutDevGas(): EventPayoutDevGas { + return { payouts: "" }; +} + +export const EventPayoutDevGas = { + encode(message: EventPayoutDevGas, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.payouts !== "") { + writer.uint32(10).string(message.payouts); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventPayoutDevGas { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventPayoutDevGas(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.payouts = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventPayoutDevGas { + return { payouts: isSet(object.payouts) ? String(object.payouts) : "" }; + }, + + toJSON(message: EventPayoutDevGas): unknown { + const obj: any = {}; + message.payouts !== undefined && (obj.payouts = message.payouts); + return obj; + }, + + create, I>>(base?: I): EventPayoutDevGas { + return EventPayoutDevGas.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): EventPayoutDevGas { + const message = createBaseEventPayoutDevGas(); + message.payouts = object.payouts ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/nibiru/devgas/v1/genesis.ts b/src/protojs/nibiru/devgas/v1/genesis.ts new file mode 100644 index 00000000..24a8a021 --- /dev/null +++ b/src/protojs/nibiru/devgas/v1/genesis.ts @@ -0,0 +1,216 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { FeeShare } from "./devgas"; + +/** GenesisState defines the module's genesis state. */ +export interface GenesisState { + /** params are the feeshare module parameters */ + params?: ModuleParams; + /** FeeShare is a slice of active registered contracts for fee distribution */ + feeShare: FeeShare[]; +} + +/** ModuleParams defines the params for the devgas module */ +export interface ModuleParams { + /** enable_feeshare defines a parameter to enable the feeshare module */ + enableFeeShare: boolean; + /** + * developer_shares defines the proportion of the transaction fees to be + * distributed to the registered contract owner + */ + developerShares: string; + /** + * allowed_denoms defines the list of denoms that are allowed to be paid to + * the contract withdraw addresses. If said denom is not in the list, the fees + * will ONLY be sent to the community pool. + * If this list is empty, all denoms are allowed. + */ + allowedDenoms: string[]; +} + +function createBaseGenesisState(): GenesisState { + return { params: undefined, feeShare: [] }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + ModuleParams.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.feeShare) { + FeeShare.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = ModuleParams.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.feeShare.push(FeeShare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? ModuleParams.fromJSON(object.params) : undefined, + feeShare: Array.isArray(object?.feeShare) ? object.feeShare.map((e: any) => FeeShare.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? ModuleParams.toJSON(message.params) : undefined); + if (message.feeShare) { + obj.feeShare = message.feeShare.map((e) => e ? FeeShare.toJSON(e) : undefined); + } else { + obj.feeShare = []; + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.params = (object.params !== undefined && object.params !== null) + ? ModuleParams.fromPartial(object.params) + : undefined; + message.feeShare = object.feeShare?.map((e) => FeeShare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseModuleParams(): ModuleParams { + return { enableFeeShare: false, developerShares: "", allowedDenoms: [] }; +} + +export const ModuleParams = { + encode(message: ModuleParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.enableFeeShare === true) { + writer.uint32(8).bool(message.enableFeeShare); + } + if (message.developerShares !== "") { + writer.uint32(18).string(message.developerShares); + } + for (const v of message.allowedDenoms) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ModuleParams { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.enableFeeShare = reader.bool(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.developerShares = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.allowedDenoms.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleParams { + return { + enableFeeShare: isSet(object.enableFeeShare) ? Boolean(object.enableFeeShare) : false, + developerShares: isSet(object.developerShares) ? String(object.developerShares) : "", + allowedDenoms: Array.isArray(object?.allowedDenoms) ? object.allowedDenoms.map((e: any) => String(e)) : [], + }; + }, + + toJSON(message: ModuleParams): unknown { + const obj: any = {}; + message.enableFeeShare !== undefined && (obj.enableFeeShare = message.enableFeeShare); + message.developerShares !== undefined && (obj.developerShares = message.developerShares); + if (message.allowedDenoms) { + obj.allowedDenoms = message.allowedDenoms.map((e) => e); + } else { + obj.allowedDenoms = []; + } + return obj; + }, + + create, I>>(base?: I): ModuleParams { + return ModuleParams.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): ModuleParams { + const message = createBaseModuleParams(); + message.enableFeeShare = object.enableFeeShare ?? false; + message.developerShares = object.developerShares ?? ""; + message.allowedDenoms = object.allowedDenoms?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/nibiru/devgas/v1/query.ts b/src/protojs/nibiru/devgas/v1/query.ts new file mode 100644 index 00000000..8ae34eca --- /dev/null +++ b/src/protojs/nibiru/devgas/v1/query.ts @@ -0,0 +1,598 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { FeeShare } from "./devgas"; +import { ModuleParams } from "./genesis"; + +/** QueryFeeSharesRequest is the request type for the Query/FeeShares RPC method. */ +export interface QueryFeeSharesRequest { + /** + * TODO feat(devgas): re-implement the paginated version + * TODO feat(colletions): add automatic pagination generation + */ + deployer: string; +} + +/** + * QueryFeeSharesResponse is the response type for the Query/FeeShares RPC + * method. + */ +export interface QueryFeeSharesResponse { + /** FeeShare is the slice of all stored Reveneue for the deployer */ + feeshare: FeeShare[]; +} + +/** QueryFeeShareRequest is the request type for the Query/FeeShare RPC method. */ +export interface QueryFeeShareRequest { + /** contract_address of a registered contract in bech32 format */ + contractAddress: string; +} + +/** QueryFeeShareResponse is the response type for the Query/FeeShare RPC method. */ +export interface QueryFeeShareResponse { + /** FeeShare is a stored Reveneue for the queried contract */ + feeshare?: FeeShare; +} + +/** 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 is the returned FeeShare parameter */ + params?: ModuleParams; +} + +/** + * QueryFeeSharesByWithdrawerRequest is the request type for the + * Query/FeeSharesByWithdrawer RPC method. + */ +export interface QueryFeeSharesByWithdrawerRequest { + /** withdrawer_address in bech32 format */ + withdrawerAddress: string; +} + +/** + * QueryFeeSharesByWithdrawerResponse is the response type for the + * Query/FeeSharesByWithdrawer RPC method. + */ +export interface QueryFeeSharesByWithdrawerResponse { + feeshare: FeeShare[]; +} + +function createBaseQueryFeeSharesRequest(): QueryFeeSharesRequest { + return { deployer: "" }; +} + +export const QueryFeeSharesRequest = { + encode(message: QueryFeeSharesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.deployer !== "") { + writer.uint32(10).string(message.deployer); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryFeeSharesRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryFeeSharesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.deployer = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryFeeSharesRequest { + return { deployer: isSet(object.deployer) ? String(object.deployer) : "" }; + }, + + toJSON(message: QueryFeeSharesRequest): unknown { + const obj: any = {}; + message.deployer !== undefined && (obj.deployer = message.deployer); + return obj; + }, + + create, I>>(base?: I): QueryFeeSharesRequest { + return QueryFeeSharesRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryFeeSharesRequest { + const message = createBaseQueryFeeSharesRequest(); + message.deployer = object.deployer ?? ""; + return message; + }, +}; + +function createBaseQueryFeeSharesResponse(): QueryFeeSharesResponse { + return { feeshare: [] }; +} + +export const QueryFeeSharesResponse = { + encode(message: QueryFeeSharesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.feeshare) { + FeeShare.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryFeeSharesResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryFeeSharesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.feeshare.push(FeeShare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryFeeSharesResponse { + return { feeshare: Array.isArray(object?.feeshare) ? object.feeshare.map((e: any) => FeeShare.fromJSON(e)) : [] }; + }, + + toJSON(message: QueryFeeSharesResponse): unknown { + const obj: any = {}; + if (message.feeshare) { + obj.feeshare = message.feeshare.map((e) => e ? FeeShare.toJSON(e) : undefined); + } else { + obj.feeshare = []; + } + return obj; + }, + + create, I>>(base?: I): QueryFeeSharesResponse { + return QueryFeeSharesResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryFeeSharesResponse { + const message = createBaseQueryFeeSharesResponse(); + message.feeshare = object.feeshare?.map((e) => FeeShare.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryFeeShareRequest(): QueryFeeShareRequest { + return { contractAddress: "" }; +} + +export const QueryFeeShareRequest = { + encode(message: QueryFeeShareRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.contractAddress !== "") { + writer.uint32(10).string(message.contractAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryFeeShareRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryFeeShareRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.contractAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryFeeShareRequest { + return { contractAddress: isSet(object.contractAddress) ? String(object.contractAddress) : "" }; + }, + + toJSON(message: QueryFeeShareRequest): unknown { + const obj: any = {}; + message.contractAddress !== undefined && (obj.contractAddress = message.contractAddress); + return obj; + }, + + create, I>>(base?: I): QueryFeeShareRequest { + return QueryFeeShareRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryFeeShareRequest { + const message = createBaseQueryFeeShareRequest(); + message.contractAddress = object.contractAddress ?? ""; + return message; + }, +}; + +function createBaseQueryFeeShareResponse(): QueryFeeShareResponse { + return { feeshare: undefined }; +} + +export const QueryFeeShareResponse = { + encode(message: QueryFeeShareResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.feeshare !== undefined) { + FeeShare.encode(message.feeshare, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryFeeShareResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryFeeShareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.feeshare = FeeShare.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryFeeShareResponse { + return { feeshare: isSet(object.feeshare) ? FeeShare.fromJSON(object.feeshare) : undefined }; + }, + + toJSON(message: QueryFeeShareResponse): unknown { + const obj: any = {}; + message.feeshare !== undefined && (obj.feeshare = message.feeshare ? FeeShare.toJSON(message.feeshare) : undefined); + return obj; + }, + + create, I>>(base?: I): QueryFeeShareResponse { + return QueryFeeShareResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryFeeShareResponse { + const message = createBaseQueryFeeShareResponse(); + message.feeshare = (object.feeshare !== undefined && object.feeshare !== null) + ? FeeShare.fromPartial(object.feeshare) + : undefined; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest = { + encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse = { + encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + ModuleParams.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = ModuleParams.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? ModuleParams.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? ModuleParams.toJSON(message.params) : undefined); + return obj; + }, + + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = (object.params !== undefined && object.params !== null) + ? ModuleParams.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryFeeSharesByWithdrawerRequest(): QueryFeeSharesByWithdrawerRequest { + return { withdrawerAddress: "" }; +} + +export const QueryFeeSharesByWithdrawerRequest = { + encode(message: QueryFeeSharesByWithdrawerRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.withdrawerAddress !== "") { + writer.uint32(10).string(message.withdrawerAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryFeeSharesByWithdrawerRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryFeeSharesByWithdrawerRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.withdrawerAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryFeeSharesByWithdrawerRequest { + return { withdrawerAddress: isSet(object.withdrawerAddress) ? String(object.withdrawerAddress) : "" }; + }, + + toJSON(message: QueryFeeSharesByWithdrawerRequest): unknown { + const obj: any = {}; + message.withdrawerAddress !== undefined && (obj.withdrawerAddress = message.withdrawerAddress); + return obj; + }, + + create, I>>( + base?: I, + ): QueryFeeSharesByWithdrawerRequest { + return QueryFeeSharesByWithdrawerRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>( + object: I, + ): QueryFeeSharesByWithdrawerRequest { + const message = createBaseQueryFeeSharesByWithdrawerRequest(); + message.withdrawerAddress = object.withdrawerAddress ?? ""; + return message; + }, +}; + +function createBaseQueryFeeSharesByWithdrawerResponse(): QueryFeeSharesByWithdrawerResponse { + return { feeshare: [] }; +} + +export const QueryFeeSharesByWithdrawerResponse = { + encode(message: QueryFeeSharesByWithdrawerResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.feeshare) { + FeeShare.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryFeeSharesByWithdrawerResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryFeeSharesByWithdrawerResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.feeshare.push(FeeShare.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryFeeSharesByWithdrawerResponse { + return { feeshare: Array.isArray(object?.feeshare) ? object.feeshare.map((e: any) => FeeShare.fromJSON(e)) : [] }; + }, + + toJSON(message: QueryFeeSharesByWithdrawerResponse): unknown { + const obj: any = {}; + if (message.feeshare) { + obj.feeshare = message.feeshare.map((e) => e ? FeeShare.toJSON(e) : undefined); + } else { + obj.feeshare = []; + } + return obj; + }, + + create, I>>( + base?: I, + ): QueryFeeSharesByWithdrawerResponse { + return QueryFeeSharesByWithdrawerResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>( + object: I, + ): QueryFeeSharesByWithdrawerResponse { + const message = createBaseQueryFeeSharesByWithdrawerResponse(); + message.feeshare = object.feeshare?.map((e) => FeeShare.fromPartial(e)) || []; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** + * FeeShares retrieves all FeeShares that a deployer has + * registered + */ + FeeShares(request: QueryFeeSharesRequest): Promise; + /** FeeShare retrieves a registered FeeShare for a given contract address */ + FeeShare(request: QueryFeeShareRequest): Promise; + /** Params retrieves the module params */ + Params(request: QueryParamsRequest): Promise; + /** + * FeeSharesByWithdrawer retrieves all FeeShares with a given withdrawer + * address + */ + FeeSharesByWithdrawer(request: QueryFeeSharesByWithdrawerRequest): Promise; +} + +export const QueryServiceName = "nibiru.devgas.v1.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.FeeShares = this.FeeShares.bind(this); + this.FeeShare = this.FeeShare.bind(this); + this.Params = this.Params.bind(this); + this.FeeSharesByWithdrawer = this.FeeSharesByWithdrawer.bind(this); + } + FeeShares(request: QueryFeeSharesRequest): Promise { + const data = QueryFeeSharesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "FeeShares", data); + return promise.then((data) => QueryFeeSharesResponse.decode(_m0.Reader.create(data))); + } + + FeeShare(request: QueryFeeShareRequest): Promise { + const data = QueryFeeShareRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "FeeShare", data); + return promise.then((data) => QueryFeeShareResponse.decode(_m0.Reader.create(data))); + } + + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => QueryParamsResponse.decode(_m0.Reader.create(data))); + } + + FeeSharesByWithdrawer(request: QueryFeeSharesByWithdrawerRequest): Promise { + const data = QueryFeeSharesByWithdrawerRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "FeeSharesByWithdrawer", data); + return promise.then((data) => QueryFeeSharesByWithdrawerResponse.decode(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/nibiru/devgas/v1/tx.ts b/src/protojs/nibiru/devgas/v1/tx.ts new file mode 100644 index 00000000..567535af --- /dev/null +++ b/src/protojs/nibiru/devgas/v1/tx.ts @@ -0,0 +1,655 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { ModuleParams } from "./genesis"; + +/** MsgRegisterFeeShare defines a message that registers a FeeShare */ +export interface MsgRegisterFeeShare { + /** contract_address in bech32 format */ + contractAddress: string; + /** + * deployer_address is the bech32 address of message sender. It must be the + * same the contract's admin address + */ + deployerAddress: string; + /** + * withdrawer_address is the bech32 address of account receiving the + * transaction fees + */ + withdrawerAddress: string; +} + +/** MsgRegisterFeeShareResponse defines the MsgRegisterFeeShare response type */ +export interface MsgRegisterFeeShareResponse { +} + +/** + * MsgUpdateFeeShare defines a message that updates the withdrawer address for a + * registered FeeShare + */ +export interface MsgUpdateFeeShare { + /** contract_address in bech32 format */ + contractAddress: string; + /** + * deployer_address is the bech32 address of message sender. It must be the + * same the contract's admin address + */ + deployerAddress: string; + /** + * withdrawer_address is the bech32 address of account receiving the + * transaction fees + */ + withdrawerAddress: string; +} + +/** MsgUpdateFeeShareResponse defines the MsgUpdateFeeShare response type */ +export interface MsgUpdateFeeShareResponse { +} + +/** MsgCancelFeeShare defines a message that cancels a registered FeeShare */ +export interface MsgCancelFeeShare { + /** contract_address in bech32 format */ + contractAddress: string; + /** + * deployer_address is the bech32 address of message sender. It must be the + * same the contract's admin address + */ + deployerAddress: string; +} + +/** MsgCancelFeeShareResponse defines the MsgCancelFeeShare response type */ +export interface MsgCancelFeeShareResponse { +} + +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** + * authority is the address that controls the module (defaults to x/gov unless + * overwritten). + */ + authority: string; + /** + * params defines the x/feeshare parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params?: ModuleParams; +} + +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse { +} + +function createBaseMsgRegisterFeeShare(): MsgRegisterFeeShare { + return { contractAddress: "", deployerAddress: "", withdrawerAddress: "" }; +} + +export const MsgRegisterFeeShare = { + encode(message: MsgRegisterFeeShare, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.contractAddress !== "") { + writer.uint32(10).string(message.contractAddress); + } + if (message.deployerAddress !== "") { + writer.uint32(18).string(message.deployerAddress); + } + if (message.withdrawerAddress !== "") { + writer.uint32(26).string(message.withdrawerAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgRegisterFeeShare { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterFeeShare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.deployerAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.withdrawerAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterFeeShare { + return { + contractAddress: isSet(object.contractAddress) ? String(object.contractAddress) : "", + deployerAddress: isSet(object.deployerAddress) ? String(object.deployerAddress) : "", + withdrawerAddress: isSet(object.withdrawerAddress) ? String(object.withdrawerAddress) : "", + }; + }, + + toJSON(message: MsgRegisterFeeShare): unknown { + const obj: any = {}; + message.contractAddress !== undefined && (obj.contractAddress = message.contractAddress); + message.deployerAddress !== undefined && (obj.deployerAddress = message.deployerAddress); + message.withdrawerAddress !== undefined && (obj.withdrawerAddress = message.withdrawerAddress); + return obj; + }, + + create, I>>(base?: I): MsgRegisterFeeShare { + return MsgRegisterFeeShare.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): MsgRegisterFeeShare { + const message = createBaseMsgRegisterFeeShare(); + message.contractAddress = object.contractAddress ?? ""; + message.deployerAddress = object.deployerAddress ?? ""; + message.withdrawerAddress = object.withdrawerAddress ?? ""; + return message; + }, +}; + +function createBaseMsgRegisterFeeShareResponse(): MsgRegisterFeeShareResponse { + return {}; +} + +export const MsgRegisterFeeShareResponse = { + encode(_: MsgRegisterFeeShareResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgRegisterFeeShareResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterFeeShareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRegisterFeeShareResponse { + return {}; + }, + + toJSON(_: MsgRegisterFeeShareResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRegisterFeeShareResponse { + return MsgRegisterFeeShareResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(_: I): MsgRegisterFeeShareResponse { + const message = createBaseMsgRegisterFeeShareResponse(); + return message; + }, +}; + +function createBaseMsgUpdateFeeShare(): MsgUpdateFeeShare { + return { contractAddress: "", deployerAddress: "", withdrawerAddress: "" }; +} + +export const MsgUpdateFeeShare = { + encode(message: MsgUpdateFeeShare, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.contractAddress !== "") { + writer.uint32(10).string(message.contractAddress); + } + if (message.deployerAddress !== "") { + writer.uint32(18).string(message.deployerAddress); + } + if (message.withdrawerAddress !== "") { + writer.uint32(26).string(message.withdrawerAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateFeeShare { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateFeeShare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.deployerAddress = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.withdrawerAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateFeeShare { + return { + contractAddress: isSet(object.contractAddress) ? String(object.contractAddress) : "", + deployerAddress: isSet(object.deployerAddress) ? String(object.deployerAddress) : "", + withdrawerAddress: isSet(object.withdrawerAddress) ? String(object.withdrawerAddress) : "", + }; + }, + + toJSON(message: MsgUpdateFeeShare): unknown { + const obj: any = {}; + message.contractAddress !== undefined && (obj.contractAddress = message.contractAddress); + message.deployerAddress !== undefined && (obj.deployerAddress = message.deployerAddress); + message.withdrawerAddress !== undefined && (obj.withdrawerAddress = message.withdrawerAddress); + return obj; + }, + + create, I>>(base?: I): MsgUpdateFeeShare { + return MsgUpdateFeeShare.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): MsgUpdateFeeShare { + const message = createBaseMsgUpdateFeeShare(); + message.contractAddress = object.contractAddress ?? ""; + message.deployerAddress = object.deployerAddress ?? ""; + message.withdrawerAddress = object.withdrawerAddress ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateFeeShareResponse(): MsgUpdateFeeShareResponse { + return {}; +} + +export const MsgUpdateFeeShareResponse = { + encode(_: MsgUpdateFeeShareResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateFeeShareResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateFeeShareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateFeeShareResponse { + return {}; + }, + + toJSON(_: MsgUpdateFeeShareResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateFeeShareResponse { + return MsgUpdateFeeShareResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(_: I): MsgUpdateFeeShareResponse { + const message = createBaseMsgUpdateFeeShareResponse(); + return message; + }, +}; + +function createBaseMsgCancelFeeShare(): MsgCancelFeeShare { + return { contractAddress: "", deployerAddress: "" }; +} + +export const MsgCancelFeeShare = { + encode(message: MsgCancelFeeShare, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.contractAddress !== "") { + writer.uint32(10).string(message.contractAddress); + } + if (message.deployerAddress !== "") { + writer.uint32(18).string(message.deployerAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCancelFeeShare { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelFeeShare(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.contractAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.deployerAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCancelFeeShare { + return { + contractAddress: isSet(object.contractAddress) ? String(object.contractAddress) : "", + deployerAddress: isSet(object.deployerAddress) ? String(object.deployerAddress) : "", + }; + }, + + toJSON(message: MsgCancelFeeShare): unknown { + const obj: any = {}; + message.contractAddress !== undefined && (obj.contractAddress = message.contractAddress); + message.deployerAddress !== undefined && (obj.deployerAddress = message.deployerAddress); + return obj; + }, + + create, I>>(base?: I): MsgCancelFeeShare { + return MsgCancelFeeShare.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): MsgCancelFeeShare { + const message = createBaseMsgCancelFeeShare(); + message.contractAddress = object.contractAddress ?? ""; + message.deployerAddress = object.deployerAddress ?? ""; + return message; + }, +}; + +function createBaseMsgCancelFeeShareResponse(): MsgCancelFeeShareResponse { + return {}; +} + +export const MsgCancelFeeShareResponse = { + encode(_: MsgCancelFeeShareResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCancelFeeShareResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelFeeShareResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCancelFeeShareResponse { + return {}; + }, + + toJSON(_: MsgCancelFeeShareResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCancelFeeShareResponse { + return MsgCancelFeeShareResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(_: I): MsgCancelFeeShareResponse { + const message = createBaseMsgCancelFeeShareResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + ModuleParams.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = ModuleParams.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + params: isSet(object.params) ? ModuleParams.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + message.authority !== undefined && (obj.authority = message.authority); + message.params !== undefined && (obj.params = message.params ? ModuleParams.toJSON(message.params) : undefined); + return obj; + }, + + create, I>>(base?: I): MsgUpdateParams { + return MsgUpdateParams.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? ModuleParams.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +/** Msg defines the fees Msg service. */ +export interface Msg { + /** RegisterFeeShare registers a new contract for receiving transaction fees */ + RegisterFeeShare(request: MsgRegisterFeeShare): Promise; + /** UpdateFeeShare updates the withdrawer address of a FeeShare */ + UpdateFeeShare(request: MsgUpdateFeeShare): Promise; + /** + * CancelFeeShare cancels a contract's fee registration and further receival + * of transaction fees + */ + CancelFeeShare(request: MsgCancelFeeShare): Promise; + /** Update the params of the module through gov v1 type. */ + UpdateParams(request: MsgUpdateParams): Promise; +} + +export const MsgServiceName = "nibiru.devgas.v1.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.RegisterFeeShare = this.RegisterFeeShare.bind(this); + this.UpdateFeeShare = this.UpdateFeeShare.bind(this); + this.CancelFeeShare = this.CancelFeeShare.bind(this); + this.UpdateParams = this.UpdateParams.bind(this); + } + RegisterFeeShare(request: MsgRegisterFeeShare): Promise { + const data = MsgRegisterFeeShare.encode(request).finish(); + const promise = this.rpc.request(this.service, "RegisterFeeShare", data); + return promise.then((data) => MsgRegisterFeeShareResponse.decode(_m0.Reader.create(data))); + } + + UpdateFeeShare(request: MsgUpdateFeeShare): Promise { + const data = MsgUpdateFeeShare.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateFeeShare", data); + return promise.then((data) => MsgUpdateFeeShareResponse.decode(_m0.Reader.create(data))); + } + + CancelFeeShare(request: MsgCancelFeeShare): Promise { + const data = MsgCancelFeeShare.encode(request).finish(); + const promise = this.rpc.request(this.service, "CancelFeeShare", data); + return promise.then((data) => MsgCancelFeeShareResponse.decode(_m0.Reader.create(data))); + } + + UpdateParams(request: MsgUpdateParams): Promise { + const data = MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateParams", data); + return promise.then((data) => MsgUpdateParamsResponse.decode(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/nibiru/epochs/v1/event.ts b/src/protojs/nibiru/epochs/v1/event.ts new file mode 100644 index 00000000..f6858204 --- /dev/null +++ b/src/protojs/nibiru/epochs/v1/event.ts @@ -0,0 +1,194 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Timestamp } from "../../../google/protobuf/timestamp"; + +export interface EventEpochStart { + /** Epoch number, starting from 1. */ + epochNumber: Long; + /** The start timestamp of the epoch. */ + epochStartTime?: Date; +} + +export interface EventEpochEnd { + /** Epoch number, starting from 1. */ + epochNumber: Long; +} + +function createBaseEventEpochStart(): EventEpochStart { + return { epochNumber: Long.UZERO, epochStartTime: undefined }; +} + +export const EventEpochStart = { + encode(message: EventEpochStart, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (!message.epochNumber.isZero()) { + writer.uint32(8).uint64(message.epochNumber); + } + if (message.epochStartTime !== undefined) { + Timestamp.encode(toTimestamp(message.epochStartTime), writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventEpochStart { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventEpochStart(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.epochNumber = reader.uint64() as Long; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.epochStartTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventEpochStart { + return { + epochNumber: isSet(object.epochNumber) ? Long.fromValue(object.epochNumber) : Long.UZERO, + epochStartTime: isSet(object.epochStartTime) ? fromJsonTimestamp(object.epochStartTime) : undefined, + }; + }, + + toJSON(message: EventEpochStart): unknown { + const obj: any = {}; + message.epochNumber !== undefined && (obj.epochNumber = (message.epochNumber || Long.UZERO).toString()); + message.epochStartTime !== undefined && (obj.epochStartTime = message.epochStartTime.toISOString()); + return obj; + }, + + create, I>>(base?: I): EventEpochStart { + return EventEpochStart.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): EventEpochStart { + const message = createBaseEventEpochStart(); + message.epochNumber = (object.epochNumber !== undefined && object.epochNumber !== null) + ? Long.fromValue(object.epochNumber) + : Long.UZERO; + message.epochStartTime = object.epochStartTime ?? undefined; + return message; + }, +}; + +function createBaseEventEpochEnd(): EventEpochEnd { + return { epochNumber: Long.UZERO }; +} + +export const EventEpochEnd = { + encode(message: EventEpochEnd, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (!message.epochNumber.isZero()) { + writer.uint32(8).uint64(message.epochNumber); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventEpochEnd { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventEpochEnd(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.epochNumber = reader.uint64() as Long; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventEpochEnd { + return { epochNumber: isSet(object.epochNumber) ? Long.fromValue(object.epochNumber) : Long.UZERO }; + }, + + toJSON(message: EventEpochEnd): unknown { + const obj: any = {}; + message.epochNumber !== undefined && (obj.epochNumber = (message.epochNumber || Long.UZERO).toString()); + return obj; + }, + + create, I>>(base?: I): EventEpochEnd { + return EventEpochEnd.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): EventEpochEnd { + const message = createBaseEventEpochEnd(); + message.epochNumber = (object.epochNumber !== undefined && object.epochNumber !== null) + ? Long.fromValue(object.epochNumber) + : Long.UZERO; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function toTimestamp(date: Date): Timestamp { + const seconds = numberToLong(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.toNumber() || 0) * 1_000; + millis += (t.nanos || 0) / 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 numberToLong(number: number) { + return Long.fromNumber(number); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/nibiru/epochs/v1/genesis.ts b/src/protojs/nibiru/epochs/v1/genesis.ts new file mode 100644 index 00000000..a44e97ee --- /dev/null +++ b/src/protojs/nibiru/epochs/v1/genesis.ts @@ -0,0 +1,86 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { EpochInfo } from "./state"; + +/** GenesisState defines the epochs module's genesis state. */ +export interface GenesisState { + epochs: EpochInfo[]; +} + +function createBaseGenesisState(): GenesisState { + return { epochs: [] }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.epochs) { + EpochInfo.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.epochs.push(EpochInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { epochs: Array.isArray(object?.epochs) ? object.epochs.map((e: any) => EpochInfo.fromJSON(e)) : [] }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.epochs) { + obj.epochs = message.epochs.map((e) => e ? EpochInfo.toJSON(e) : undefined); + } else { + obj.epochs = []; + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.epochs = object.epochs?.map((e) => EpochInfo.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} diff --git a/src/protojs/nibiru/epochs/v1/query.ts b/src/protojs/nibiru/epochs/v1/query.ts new file mode 100644 index 00000000..472d7ba0 --- /dev/null +++ b/src/protojs/nibiru/epochs/v1/query.ts @@ -0,0 +1,293 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { EpochInfo } from "./state"; + +export interface QueryEpochInfosRequest { +} + +export interface QueryEpochInfosResponse { + epochs: EpochInfo[]; +} + +export interface QueryCurrentEpochRequest { + identifier: string; +} + +export interface QueryCurrentEpochResponse { + currentEpoch: Long; +} + +function createBaseQueryEpochInfosRequest(): QueryEpochInfosRequest { + return {}; +} + +export const QueryEpochInfosRequest = { + encode(_: QueryEpochInfosRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryEpochInfosRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEpochInfosRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryEpochInfosRequest { + return {}; + }, + + toJSON(_: QueryEpochInfosRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryEpochInfosRequest { + return QueryEpochInfosRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>(_: I): QueryEpochInfosRequest { + const message = createBaseQueryEpochInfosRequest(); + return message; + }, +}; + +function createBaseQueryEpochInfosResponse(): QueryEpochInfosResponse { + return { epochs: [] }; +} + +export const QueryEpochInfosResponse = { + encode(message: QueryEpochInfosResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.epochs) { + EpochInfo.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryEpochInfosResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEpochInfosResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.epochs.push(EpochInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEpochInfosResponse { + return { epochs: Array.isArray(object?.epochs) ? object.epochs.map((e: any) => EpochInfo.fromJSON(e)) : [] }; + }, + + toJSON(message: QueryEpochInfosResponse): unknown { + const obj: any = {}; + if (message.epochs) { + obj.epochs = message.epochs.map((e) => e ? EpochInfo.toJSON(e) : undefined); + } else { + obj.epochs = []; + } + return obj; + }, + + create, I>>(base?: I): QueryEpochInfosResponse { + return QueryEpochInfosResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryEpochInfosResponse { + const message = createBaseQueryEpochInfosResponse(); + message.epochs = object.epochs?.map((e) => EpochInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryCurrentEpochRequest(): QueryCurrentEpochRequest { + return { identifier: "" }; +} + +export const QueryCurrentEpochRequest = { + encode(message: QueryCurrentEpochRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.identifier !== "") { + writer.uint32(10).string(message.identifier); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryCurrentEpochRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCurrentEpochRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identifier = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCurrentEpochRequest { + return { identifier: isSet(object.identifier) ? String(object.identifier) : "" }; + }, + + toJSON(message: QueryCurrentEpochRequest): unknown { + const obj: any = {}; + message.identifier !== undefined && (obj.identifier = message.identifier); + return obj; + }, + + create, I>>(base?: I): QueryCurrentEpochRequest { + return QueryCurrentEpochRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryCurrentEpochRequest { + const message = createBaseQueryCurrentEpochRequest(); + message.identifier = object.identifier ?? ""; + return message; + }, +}; + +function createBaseQueryCurrentEpochResponse(): QueryCurrentEpochResponse { + return { currentEpoch: Long.UZERO }; +} + +export const QueryCurrentEpochResponse = { + encode(message: QueryCurrentEpochResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (!message.currentEpoch.isZero()) { + writer.uint32(8).uint64(message.currentEpoch); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryCurrentEpochResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCurrentEpochResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.currentEpoch = reader.uint64() as Long; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCurrentEpochResponse { + return { currentEpoch: isSet(object.currentEpoch) ? Long.fromValue(object.currentEpoch) : Long.UZERO }; + }, + + toJSON(message: QueryCurrentEpochResponse): unknown { + const obj: any = {}; + message.currentEpoch !== undefined && (obj.currentEpoch = (message.currentEpoch || Long.UZERO).toString()); + return obj; + }, + + create, I>>(base?: I): QueryCurrentEpochResponse { + return QueryCurrentEpochResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryCurrentEpochResponse { + const message = createBaseQueryCurrentEpochResponse(); + message.currentEpoch = (object.currentEpoch !== undefined && object.currentEpoch !== null) + ? Long.fromValue(object.currentEpoch) + : Long.UZERO; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** EpochInfos provide running epochInfos */ + EpochInfos(request: QueryEpochInfosRequest): Promise; + /** CurrentEpoch provide current epoch of specified identifier */ + CurrentEpoch(request: QueryCurrentEpochRequest): Promise; +} + +export const QueryServiceName = "nibiru.epochs.v1.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.EpochInfos = this.EpochInfos.bind(this); + this.CurrentEpoch = this.CurrentEpoch.bind(this); + } + EpochInfos(request: QueryEpochInfosRequest): Promise { + const data = QueryEpochInfosRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EpochInfos", data); + return promise.then((data) => QueryEpochInfosResponse.decode(_m0.Reader.create(data))); + } + + CurrentEpoch(request: QueryCurrentEpochRequest): Promise { + const data = QueryCurrentEpochRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "CurrentEpoch", data); + return promise.then((data) => QueryCurrentEpochResponse.decode(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/nibiru/epochs/v1/state.ts b/src/protojs/nibiru/epochs/v1/state.ts new file mode 100644 index 00000000..bf1d1b6b --- /dev/null +++ b/src/protojs/nibiru/epochs/v1/state.ts @@ -0,0 +1,229 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Duration } from "../../../google/protobuf/duration"; +import { Timestamp } from "../../../google/protobuf/timestamp"; + +export interface EpochInfo { + /** A string identifier for the epoch. e.g. "15min" or "1hour" */ + identifier: string; + /** When the epoch repetitino should start. */ + startTime?: Date; + /** How long each epoch lasts for. */ + duration?: Duration; + /** The current epoch number, starting from 1. */ + currentEpoch: Long; + /** The start timestamp of the current epoch. */ + currentEpochStartTime?: Date; + /** + * Whether or not this epoch has started. Set to true if current blocktime >= + * start_time. + */ + epochCountingStarted: boolean; + /** The block height at which the current epoch started at. */ + currentEpochStartHeight: Long; +} + +function createBaseEpochInfo(): EpochInfo { + return { + identifier: "", + startTime: undefined, + duration: undefined, + currentEpoch: Long.UZERO, + currentEpochStartTime: undefined, + epochCountingStarted: false, + currentEpochStartHeight: Long.ZERO, + }; +} + +export const EpochInfo = { + encode(message: EpochInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.identifier !== "") { + writer.uint32(10).string(message.identifier); + } + if (message.startTime !== undefined) { + Timestamp.encode(toTimestamp(message.startTime), writer.uint32(18).fork()).ldelim(); + } + if (message.duration !== undefined) { + Duration.encode(message.duration, writer.uint32(26).fork()).ldelim(); + } + if (!message.currentEpoch.isZero()) { + writer.uint32(32).uint64(message.currentEpoch); + } + if (message.currentEpochStartTime !== undefined) { + Timestamp.encode(toTimestamp(message.currentEpochStartTime), writer.uint32(42).fork()).ldelim(); + } + if (message.epochCountingStarted === true) { + writer.uint32(48).bool(message.epochCountingStarted); + } + if (!message.currentEpochStartHeight.isZero()) { + writer.uint32(56).int64(message.currentEpochStartHeight); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EpochInfo { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEpochInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.identifier = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.startTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.duration = Duration.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.currentEpoch = reader.uint64() as Long; + continue; + case 5: + if (tag !== 42) { + break; + } + + message.currentEpochStartTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.epochCountingStarted = reader.bool(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.currentEpochStartHeight = reader.int64() as Long; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): EpochInfo { + return { + identifier: isSet(object.identifier) ? String(object.identifier) : "", + startTime: isSet(object.startTime) ? fromJsonTimestamp(object.startTime) : undefined, + duration: isSet(object.duration) ? Duration.fromJSON(object.duration) : undefined, + currentEpoch: isSet(object.currentEpoch) ? Long.fromValue(object.currentEpoch) : Long.UZERO, + currentEpochStartTime: isSet(object.currentEpochStartTime) + ? fromJsonTimestamp(object.currentEpochStartTime) + : undefined, + epochCountingStarted: isSet(object.epochCountingStarted) ? Boolean(object.epochCountingStarted) : false, + currentEpochStartHeight: isSet(object.currentEpochStartHeight) + ? Long.fromValue(object.currentEpochStartHeight) + : Long.ZERO, + }; + }, + + toJSON(message: EpochInfo): unknown { + const obj: any = {}; + message.identifier !== undefined && (obj.identifier = message.identifier); + message.startTime !== undefined && (obj.startTime = message.startTime.toISOString()); + message.duration !== undefined && (obj.duration = message.duration ? Duration.toJSON(message.duration) : undefined); + message.currentEpoch !== undefined && (obj.currentEpoch = (message.currentEpoch || Long.UZERO).toString()); + message.currentEpochStartTime !== undefined && + (obj.currentEpochStartTime = message.currentEpochStartTime.toISOString()); + message.epochCountingStarted !== undefined && (obj.epochCountingStarted = message.epochCountingStarted); + message.currentEpochStartHeight !== undefined && + (obj.currentEpochStartHeight = (message.currentEpochStartHeight || Long.ZERO).toString()); + return obj; + }, + + create, I>>(base?: I): EpochInfo { + return EpochInfo.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): EpochInfo { + const message = createBaseEpochInfo(); + message.identifier = object.identifier ?? ""; + message.startTime = object.startTime ?? undefined; + message.duration = (object.duration !== undefined && object.duration !== null) + ? Duration.fromPartial(object.duration) + : undefined; + message.currentEpoch = (object.currentEpoch !== undefined && object.currentEpoch !== null) + ? Long.fromValue(object.currentEpoch) + : Long.UZERO; + message.currentEpochStartTime = object.currentEpochStartTime ?? undefined; + message.epochCountingStarted = object.epochCountingStarted ?? false; + message.currentEpochStartHeight = + (object.currentEpochStartHeight !== undefined && object.currentEpochStartHeight !== null) + ? Long.fromValue(object.currentEpochStartHeight) + : Long.ZERO; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function toTimestamp(date: Date): Timestamp { + const seconds = numberToLong(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.toNumber() || 0) * 1_000; + millis += (t.nanos || 0) / 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 numberToLong(number: number) { + return Long.fromNumber(number); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/nibiru/genmsg/v1/genmsg.ts b/src/protojs/nibiru/genmsg/v1/genmsg.ts new file mode 100644 index 00000000..c29fb6f0 --- /dev/null +++ b/src/protojs/nibiru/genmsg/v1/genmsg.ts @@ -0,0 +1,86 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; + +/** GenesisState represents the messages to be processed during genesis by the genmsg module. */ +export interface GenesisState { + messages: Any[]; +} + +function createBaseGenesisState(): GenesisState { + return { messages: [] }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.messages) { + Any.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.messages.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [] }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.messages) { + obj.messages = message.messages.map((e) => e ? Any.toJSON(e) : undefined); + } else { + obj.messages = []; + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.messages = object.messages?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} diff --git a/src/protojs/nibiru/inflation/v1/event.ts b/src/protojs/nibiru/inflation/v1/event.ts new file mode 100644 index 00000000..58569956 --- /dev/null +++ b/src/protojs/nibiru/inflation/v1/event.ts @@ -0,0 +1,128 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../../cosmos/base/v1beta1/coin"; + +/** + * EventInflationDistribution: Emitted when NIBI tokens are minted on the + * network based on Nibiru's inflation schedule. + */ +export interface EventInflationDistribution { + stakingRewards?: Coin; + strategicReserve?: Coin; + communityPool?: Coin; +} + +function createBaseEventInflationDistribution(): EventInflationDistribution { + return { stakingRewards: undefined, strategicReserve: undefined, communityPool: undefined }; +} + +export const EventInflationDistribution = { + encode(message: EventInflationDistribution, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.stakingRewards !== undefined) { + Coin.encode(message.stakingRewards, writer.uint32(10).fork()).ldelim(); + } + if (message.strategicReserve !== undefined) { + Coin.encode(message.strategicReserve, writer.uint32(18).fork()).ldelim(); + } + if (message.communityPool !== undefined) { + Coin.encode(message.communityPool, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventInflationDistribution { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventInflationDistribution(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.stakingRewards = Coin.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.strategicReserve = Coin.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.communityPool = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventInflationDistribution { + return { + stakingRewards: isSet(object.stakingRewards) ? Coin.fromJSON(object.stakingRewards) : undefined, + strategicReserve: isSet(object.strategicReserve) ? Coin.fromJSON(object.strategicReserve) : undefined, + communityPool: isSet(object.communityPool) ? Coin.fromJSON(object.communityPool) : undefined, + }; + }, + + toJSON(message: EventInflationDistribution): unknown { + const obj: any = {}; + message.stakingRewards !== undefined && + (obj.stakingRewards = message.stakingRewards ? Coin.toJSON(message.stakingRewards) : undefined); + message.strategicReserve !== undefined && + (obj.strategicReserve = message.strategicReserve ? Coin.toJSON(message.strategicReserve) : undefined); + message.communityPool !== undefined && + (obj.communityPool = message.communityPool ? Coin.toJSON(message.communityPool) : undefined); + return obj; + }, + + create, I>>(base?: I): EventInflationDistribution { + return EventInflationDistribution.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): EventInflationDistribution { + const message = createBaseEventInflationDistribution(); + message.stakingRewards = (object.stakingRewards !== undefined && object.stakingRewards !== null) + ? Coin.fromPartial(object.stakingRewards) + : undefined; + message.strategicReserve = (object.strategicReserve !== undefined && object.strategicReserve !== null) + ? Coin.fromPartial(object.strategicReserve) + : undefined; + message.communityPool = (object.communityPool !== undefined && object.communityPool !== null) + ? Coin.fromPartial(object.communityPool) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/nibiru/inflation/v1/genesis.ts b/src/protojs/nibiru/inflation/v1/genesis.ts new file mode 100644 index 00000000..6b43f838 --- /dev/null +++ b/src/protojs/nibiru/inflation/v1/genesis.ts @@ -0,0 +1,325 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { InflationDistribution } from "./inflation"; + +/** GenesisState defines the inflation module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params?: Params; + /** period is the amount of past periods, based on the epochs per period param */ + period: Long; + /** + * skipped_epochs is the number of epochs that have passed while inflation is + * disabled + */ + skippedEpochs: Long; +} + +/** Params holds parameters for the inflation module. */ +export interface Params { + /** + * inflation_enabled is the parameter that enables inflation and halts + * increasing the skipped_epochs + */ + inflationEnabled: boolean; + /** + * polynomial_factors takes in the variables to calculate polynomial + * inflation + */ + polynomialFactors: string[]; + /** inflation_distribution of the minted denom */ + inflationDistribution?: InflationDistribution; + /** + * epochs_per_period is the number of epochs that must pass before a new + * period is created + */ + epochsPerPeriod: Long; + /** periods_per_year is the number of periods that occur in a year */ + periodsPerYear: Long; + /** + * max_period is the maximum number of periods that have inflation being + * paid off. After this period, inflation will be disabled. + */ + maxPeriod: Long; + /** + * has_inflation_started is the parameter that indicates if inflation has + * started. It's set to false at the starts, and stays at true when we toggle + * inflation on. It's used to track num skipped epochs + */ + hasInflationStarted: boolean; +} + +function createBaseGenesisState(): GenesisState { + return { params: undefined, period: Long.UZERO, skippedEpochs: Long.UZERO }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + if (!message.period.isZero()) { + writer.uint32(16).uint64(message.period); + } + if (!message.skippedEpochs.isZero()) { + writer.uint32(24).uint64(message.skippedEpochs); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = reader.uint64() as Long; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.skippedEpochs = reader.uint64() as Long; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + period: isSet(object.period) ? Long.fromValue(object.period) : Long.UZERO, + skippedEpochs: isSet(object.skippedEpochs) ? Long.fromValue(object.skippedEpochs) : Long.UZERO, + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + message.period !== undefined && (obj.period = (message.period || Long.UZERO).toString()); + message.skippedEpochs !== undefined && (obj.skippedEpochs = (message.skippedEpochs || Long.UZERO).toString()); + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + message.period = (object.period !== undefined && object.period !== null) + ? Long.fromValue(object.period) + : Long.UZERO; + message.skippedEpochs = (object.skippedEpochs !== undefined && object.skippedEpochs !== null) + ? Long.fromValue(object.skippedEpochs) + : Long.UZERO; + return message; + }, +}; + +function createBaseParams(): Params { + return { + inflationEnabled: false, + polynomialFactors: [], + inflationDistribution: undefined, + epochsPerPeriod: Long.UZERO, + periodsPerYear: Long.UZERO, + maxPeriod: Long.UZERO, + hasInflationStarted: false, + }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.inflationEnabled === true) { + writer.uint32(8).bool(message.inflationEnabled); + } + for (const v of message.polynomialFactors) { + writer.uint32(18).string(v!); + } + if (message.inflationDistribution !== undefined) { + InflationDistribution.encode(message.inflationDistribution, writer.uint32(26).fork()).ldelim(); + } + if (!message.epochsPerPeriod.isZero()) { + writer.uint32(32).uint64(message.epochsPerPeriod); + } + if (!message.periodsPerYear.isZero()) { + writer.uint32(40).uint64(message.periodsPerYear); + } + if (!message.maxPeriod.isZero()) { + writer.uint32(48).uint64(message.maxPeriod); + } + if (message.hasInflationStarted === true) { + writer.uint32(56).bool(message.hasInflationStarted); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.inflationEnabled = reader.bool(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.polynomialFactors.push(reader.string()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.inflationDistribution = InflationDistribution.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.epochsPerPeriod = reader.uint64() as Long; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.periodsPerYear = reader.uint64() as Long; + continue; + case 6: + if (tag !== 48) { + break; + } + + message.maxPeriod = reader.uint64() as Long; + continue; + case 7: + if (tag !== 56) { + break; + } + + message.hasInflationStarted = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + inflationEnabled: isSet(object.inflationEnabled) ? Boolean(object.inflationEnabled) : false, + polynomialFactors: Array.isArray(object?.polynomialFactors) + ? object.polynomialFactors.map((e: any) => String(e)) + : [], + inflationDistribution: isSet(object.inflationDistribution) + ? InflationDistribution.fromJSON(object.inflationDistribution) + : undefined, + epochsPerPeriod: isSet(object.epochsPerPeriod) ? Long.fromValue(object.epochsPerPeriod) : Long.UZERO, + periodsPerYear: isSet(object.periodsPerYear) ? Long.fromValue(object.periodsPerYear) : Long.UZERO, + maxPeriod: isSet(object.maxPeriod) ? Long.fromValue(object.maxPeriod) : Long.UZERO, + hasInflationStarted: isSet(object.hasInflationStarted) ? Boolean(object.hasInflationStarted) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + message.inflationEnabled !== undefined && (obj.inflationEnabled = message.inflationEnabled); + if (message.polynomialFactors) { + obj.polynomialFactors = message.polynomialFactors.map((e) => e); + } else { + obj.polynomialFactors = []; + } + message.inflationDistribution !== undefined && (obj.inflationDistribution = message.inflationDistribution + ? InflationDistribution.toJSON(message.inflationDistribution) + : undefined); + message.epochsPerPeriod !== undefined && (obj.epochsPerPeriod = (message.epochsPerPeriod || Long.UZERO).toString()); + message.periodsPerYear !== undefined && (obj.periodsPerYear = (message.periodsPerYear || Long.UZERO).toString()); + message.maxPeriod !== undefined && (obj.maxPeriod = (message.maxPeriod || Long.UZERO).toString()); + message.hasInflationStarted !== undefined && (obj.hasInflationStarted = message.hasInflationStarted); + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.inflationEnabled = object.inflationEnabled ?? false; + message.polynomialFactors = object.polynomialFactors?.map((e) => e) || []; + message.inflationDistribution = + (object.inflationDistribution !== undefined && object.inflationDistribution !== null) + ? InflationDistribution.fromPartial(object.inflationDistribution) + : undefined; + message.epochsPerPeriod = (object.epochsPerPeriod !== undefined && object.epochsPerPeriod !== null) + ? Long.fromValue(object.epochsPerPeriod) + : Long.UZERO; + message.periodsPerYear = (object.periodsPerYear !== undefined && object.periodsPerYear !== null) + ? Long.fromValue(object.periodsPerYear) + : Long.UZERO; + message.maxPeriod = (object.maxPeriod !== undefined && object.maxPeriod !== null) + ? Long.fromValue(object.maxPeriod) + : Long.UZERO; + message.hasInflationStarted = object.hasInflationStarted ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/nibiru/inflation/v1/inflation.ts b/src/protojs/nibiru/inflation/v1/inflation.ts new file mode 100644 index 00000000..c32aaa46 --- /dev/null +++ b/src/protojs/nibiru/inflation/v1/inflation.ts @@ -0,0 +1,131 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +/** + * InflationDistribution defines the distribution in which inflation is + * allocated through minting on each epoch (staking, community, strategic). It + * excludes the team vesting distribution. + */ +export interface InflationDistribution { + /** + * staking_rewards defines the proportion of the minted_denom that is + * to be allocated as staking rewards + */ + stakingRewards: string; + /** + * community_pool defines the proportion of the minted_denom that is to + * be allocated to the community pool + */ + communityPool: string; + /** + * strategic_reserves defines the proportion of the minted_denom that + * is to be allocated to the strategic reserves module address + */ + strategicReserves: string; +} + +function createBaseInflationDistribution(): InflationDistribution { + return { stakingRewards: "", communityPool: "", strategicReserves: "" }; +} + +export const InflationDistribution = { + encode(message: InflationDistribution, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.stakingRewards !== "") { + writer.uint32(10).string(message.stakingRewards); + } + if (message.communityPool !== "") { + writer.uint32(18).string(message.communityPool); + } + if (message.strategicReserves !== "") { + writer.uint32(26).string(message.strategicReserves); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): InflationDistribution { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInflationDistribution(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.stakingRewards = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.communityPool = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.strategicReserves = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): InflationDistribution { + return { + stakingRewards: isSet(object.stakingRewards) ? String(object.stakingRewards) : "", + communityPool: isSet(object.communityPool) ? String(object.communityPool) : "", + strategicReserves: isSet(object.strategicReserves) ? String(object.strategicReserves) : "", + }; + }, + + toJSON(message: InflationDistribution): unknown { + const obj: any = {}; + message.stakingRewards !== undefined && (obj.stakingRewards = message.stakingRewards); + message.communityPool !== undefined && (obj.communityPool = message.communityPool); + message.strategicReserves !== undefined && (obj.strategicReserves = message.strategicReserves); + return obj; + }, + + create, I>>(base?: I): InflationDistribution { + return InflationDistribution.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): InflationDistribution { + const message = createBaseInflationDistribution(); + message.stakingRewards = object.stakingRewards ?? ""; + message.communityPool = object.communityPool ?? ""; + message.strategicReserves = object.strategicReserves ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/nibiru/inflation/v1/query.ts b/src/protojs/nibiru/inflation/v1/query.ts new file mode 100644 index 00000000..aa121611 --- /dev/null +++ b/src/protojs/nibiru/inflation/v1/query.ts @@ -0,0 +1,807 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { DecCoin } from "../../../cosmos/base/v1beta1/coin"; +import { Params } from "./genesis"; + +/** QueryPeriodRequest is the request type for the Query/Period RPC method. */ +export interface QueryPeriodRequest { +} + +/** QueryPeriodResponse is the response type for the Query/Period RPC method. */ +export interface QueryPeriodResponse { + /** period is the current minting per epoch provision value. */ + period: Long; +} + +/** + * QueryEpochMintProvisionRequest is the request type for the + * Query/EpochMintProvision RPC method. + */ +export interface QueryEpochMintProvisionRequest { +} + +/** + * QueryEpochMintProvisionResponse is the response type for the + * Query/EpochMintProvision RPC method. + */ +export interface QueryEpochMintProvisionResponse { + /** epoch_mint_provision is the current minting per epoch provision value. */ + epochMintProvision?: DecCoin; +} + +/** + * QuerySkippedEpochsRequest is the request type for the Query/SkippedEpochs RPC + * method. + */ +export interface QuerySkippedEpochsRequest { +} + +/** + * QuerySkippedEpochsResponse is the response type for the Query/SkippedEpochs + * RPC method. + */ +export interface QuerySkippedEpochsResponse { + /** + * skipped_epochs is the number of epochs that the inflation module has been + * disabled. + */ + skippedEpochs: Long; +} + +/** + * QueryCirculatingSupplyRequest is the request type for the + * Query/CirculatingSupply RPC method. + */ +export interface QueryCirculatingSupplyRequest { +} + +/** + * QueryCirculatingSupplyResponse is the response type for the + * Query/CirculatingSupply RPC method. + */ +export interface QueryCirculatingSupplyResponse { + /** circulating_supply is the total amount of coins in circulation */ + circulatingSupply?: DecCoin; +} + +/** + * QueryInflationRateRequest is the request type for the Query/InflationRate RPC + * method. + */ +export interface QueryInflationRateRequest { +} + +/** + * QueryInflationRateResponse is the response type for the Query/InflationRate + * RPC method. + */ +export interface QueryInflationRateResponse { + /** inflation_rate by which the total supply increases within one period */ + inflationRate: string; +} + +/** 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; +} + +function createBaseQueryPeriodRequest(): QueryPeriodRequest { + return {}; +} + +export const QueryPeriodRequest = { + encode(_: QueryPeriodRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryPeriodRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPeriodRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPeriodRequest { + return {}; + }, + + toJSON(_: QueryPeriodRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPeriodRequest { + return QueryPeriodRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>(_: I): QueryPeriodRequest { + const message = createBaseQueryPeriodRequest(); + return message; + }, +}; + +function createBaseQueryPeriodResponse(): QueryPeriodResponse { + return { period: Long.UZERO }; +} + +export const QueryPeriodResponse = { + encode(message: QueryPeriodResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (!message.period.isZero()) { + writer.uint32(8).uint64(message.period); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryPeriodResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPeriodResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.period = reader.uint64() as Long; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPeriodResponse { + return { period: isSet(object.period) ? Long.fromValue(object.period) : Long.UZERO }; + }, + + toJSON(message: QueryPeriodResponse): unknown { + const obj: any = {}; + message.period !== undefined && (obj.period = (message.period || Long.UZERO).toString()); + return obj; + }, + + create, I>>(base?: I): QueryPeriodResponse { + return QueryPeriodResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryPeriodResponse { + const message = createBaseQueryPeriodResponse(); + message.period = (object.period !== undefined && object.period !== null) + ? Long.fromValue(object.period) + : Long.UZERO; + return message; + }, +}; + +function createBaseQueryEpochMintProvisionRequest(): QueryEpochMintProvisionRequest { + return {}; +} + +export const QueryEpochMintProvisionRequest = { + encode(_: QueryEpochMintProvisionRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryEpochMintProvisionRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEpochMintProvisionRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryEpochMintProvisionRequest { + return {}; + }, + + toJSON(_: QueryEpochMintProvisionRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryEpochMintProvisionRequest { + return QueryEpochMintProvisionRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>(_: I): QueryEpochMintProvisionRequest { + const message = createBaseQueryEpochMintProvisionRequest(); + return message; + }, +}; + +function createBaseQueryEpochMintProvisionResponse(): QueryEpochMintProvisionResponse { + return { epochMintProvision: undefined }; +} + +export const QueryEpochMintProvisionResponse = { + encode(message: QueryEpochMintProvisionResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.epochMintProvision !== undefined) { + DecCoin.encode(message.epochMintProvision, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryEpochMintProvisionResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEpochMintProvisionResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.epochMintProvision = DecCoin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEpochMintProvisionResponse { + return { + epochMintProvision: isSet(object.epochMintProvision) ? DecCoin.fromJSON(object.epochMintProvision) : undefined, + }; + }, + + toJSON(message: QueryEpochMintProvisionResponse): unknown { + const obj: any = {}; + message.epochMintProvision !== undefined && + (obj.epochMintProvision = message.epochMintProvision ? DecCoin.toJSON(message.epochMintProvision) : undefined); + return obj; + }, + + create, I>>(base?: I): QueryEpochMintProvisionResponse { + return QueryEpochMintProvisionResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>( + object: I, + ): QueryEpochMintProvisionResponse { + const message = createBaseQueryEpochMintProvisionResponse(); + message.epochMintProvision = (object.epochMintProvision !== undefined && object.epochMintProvision !== null) + ? DecCoin.fromPartial(object.epochMintProvision) + : undefined; + return message; + }, +}; + +function createBaseQuerySkippedEpochsRequest(): QuerySkippedEpochsRequest { + return {}; +} + +export const QuerySkippedEpochsRequest = { + encode(_: QuerySkippedEpochsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QuerySkippedEpochsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySkippedEpochsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QuerySkippedEpochsRequest { + return {}; + }, + + toJSON(_: QuerySkippedEpochsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QuerySkippedEpochsRequest { + return QuerySkippedEpochsRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>(_: I): QuerySkippedEpochsRequest { + const message = createBaseQuerySkippedEpochsRequest(); + return message; + }, +}; + +function createBaseQuerySkippedEpochsResponse(): QuerySkippedEpochsResponse { + return { skippedEpochs: Long.UZERO }; +} + +export const QuerySkippedEpochsResponse = { + encode(message: QuerySkippedEpochsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (!message.skippedEpochs.isZero()) { + writer.uint32(8).uint64(message.skippedEpochs); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QuerySkippedEpochsResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySkippedEpochsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.skippedEpochs = reader.uint64() as Long; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySkippedEpochsResponse { + return { skippedEpochs: isSet(object.skippedEpochs) ? Long.fromValue(object.skippedEpochs) : Long.UZERO }; + }, + + toJSON(message: QuerySkippedEpochsResponse): unknown { + const obj: any = {}; + message.skippedEpochs !== undefined && (obj.skippedEpochs = (message.skippedEpochs || Long.UZERO).toString()); + return obj; + }, + + create, I>>(base?: I): QuerySkippedEpochsResponse { + return QuerySkippedEpochsResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QuerySkippedEpochsResponse { + const message = createBaseQuerySkippedEpochsResponse(); + message.skippedEpochs = (object.skippedEpochs !== undefined && object.skippedEpochs !== null) + ? Long.fromValue(object.skippedEpochs) + : Long.UZERO; + return message; + }, +}; + +function createBaseQueryCirculatingSupplyRequest(): QueryCirculatingSupplyRequest { + return {}; +} + +export const QueryCirculatingSupplyRequest = { + encode(_: QueryCirculatingSupplyRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryCirculatingSupplyRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCirculatingSupplyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCirculatingSupplyRequest { + return {}; + }, + + toJSON(_: QueryCirculatingSupplyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCirculatingSupplyRequest { + return QueryCirculatingSupplyRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>(_: I): QueryCirculatingSupplyRequest { + const message = createBaseQueryCirculatingSupplyRequest(); + return message; + }, +}; + +function createBaseQueryCirculatingSupplyResponse(): QueryCirculatingSupplyResponse { + return { circulatingSupply: undefined }; +} + +export const QueryCirculatingSupplyResponse = { + encode(message: QueryCirculatingSupplyResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.circulatingSupply !== undefined) { + DecCoin.encode(message.circulatingSupply, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryCirculatingSupplyResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCirculatingSupplyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.circulatingSupply = DecCoin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCirculatingSupplyResponse { + return { + circulatingSupply: isSet(object.circulatingSupply) ? DecCoin.fromJSON(object.circulatingSupply) : undefined, + }; + }, + + toJSON(message: QueryCirculatingSupplyResponse): unknown { + const obj: any = {}; + message.circulatingSupply !== undefined && + (obj.circulatingSupply = message.circulatingSupply ? DecCoin.toJSON(message.circulatingSupply) : undefined); + return obj; + }, + + create, I>>(base?: I): QueryCirculatingSupplyResponse { + return QueryCirculatingSupplyResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>( + object: I, + ): QueryCirculatingSupplyResponse { + const message = createBaseQueryCirculatingSupplyResponse(); + message.circulatingSupply = (object.circulatingSupply !== undefined && object.circulatingSupply !== null) + ? DecCoin.fromPartial(object.circulatingSupply) + : undefined; + return message; + }, +}; + +function createBaseQueryInflationRateRequest(): QueryInflationRateRequest { + return {}; +} + +export const QueryInflationRateRequest = { + encode(_: QueryInflationRateRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryInflationRateRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryInflationRateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryInflationRateRequest { + return {}; + }, + + toJSON(_: QueryInflationRateRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryInflationRateRequest { + return QueryInflationRateRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>(_: I): QueryInflationRateRequest { + const message = createBaseQueryInflationRateRequest(); + return message; + }, +}; + +function createBaseQueryInflationRateResponse(): QueryInflationRateResponse { + return { inflationRate: "" }; +} + +export const QueryInflationRateResponse = { + encode(message: QueryInflationRateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.inflationRate !== "") { + writer.uint32(10).string(message.inflationRate); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryInflationRateResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryInflationRateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.inflationRate = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryInflationRateResponse { + return { inflationRate: isSet(object.inflationRate) ? String(object.inflationRate) : "" }; + }, + + toJSON(message: QueryInflationRateResponse): unknown { + const obj: any = {}; + message.inflationRate !== undefined && (obj.inflationRate = message.inflationRate); + return obj; + }, + + create, I>>(base?: I): QueryInflationRateResponse { + return QueryInflationRateResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryInflationRateResponse { + const message = createBaseQueryInflationRateResponse(); + message.inflationRate = object.inflationRate ?? ""; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest = { + encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse = { + encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +/** Query provides defines the gRPC querier service. */ +export interface Query { + /** Period retrieves current period. */ + Period(request: QueryPeriodRequest): Promise; + /** EpochMintProvision retrieves current minting epoch provision value. */ + EpochMintProvision(request: QueryEpochMintProvisionRequest): Promise; + /** SkippedEpochs retrieves the total number of skipped epochs. */ + SkippedEpochs(request: QuerySkippedEpochsRequest): Promise; + /** + * CirculatingSupply retrieves the total number of tokens that are in + * circulation (i.e. excluding unvested tokens). + */ + CirculatingSupply(request: QueryCirculatingSupplyRequest): Promise; + /** InflationRate retrieves the inflation rate of the current period. */ + InflationRate(request: QueryInflationRateRequest): Promise; + /** Params retrieves the total set of minting parameters. */ + Params(request: QueryParamsRequest): Promise; +} + +export const QueryServiceName = "nibiru.inflation.v1.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Period = this.Period.bind(this); + this.EpochMintProvision = this.EpochMintProvision.bind(this); + this.SkippedEpochs = this.SkippedEpochs.bind(this); + this.CirculatingSupply = this.CirculatingSupply.bind(this); + this.InflationRate = this.InflationRate.bind(this); + this.Params = this.Params.bind(this); + } + Period(request: QueryPeriodRequest): Promise { + const data = QueryPeriodRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Period", data); + return promise.then((data) => QueryPeriodResponse.decode(_m0.Reader.create(data))); + } + + EpochMintProvision(request: QueryEpochMintProvisionRequest): Promise { + const data = QueryEpochMintProvisionRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "EpochMintProvision", data); + return promise.then((data) => QueryEpochMintProvisionResponse.decode(_m0.Reader.create(data))); + } + + SkippedEpochs(request: QuerySkippedEpochsRequest): Promise { + const data = QuerySkippedEpochsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "SkippedEpochs", data); + return promise.then((data) => QuerySkippedEpochsResponse.decode(_m0.Reader.create(data))); + } + + CirculatingSupply(request: QueryCirculatingSupplyRequest): Promise { + const data = QueryCirculatingSupplyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "CirculatingSupply", data); + return promise.then((data) => QueryCirculatingSupplyResponse.decode(_m0.Reader.create(data))); + } + + InflationRate(request: QueryInflationRateRequest): Promise { + const data = QueryInflationRateRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "InflationRate", data); + return promise.then((data) => QueryInflationRateResponse.decode(_m0.Reader.create(data))); + } + + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => QueryParamsResponse.decode(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/nibiru/inflation/v1/tx.ts b/src/protojs/nibiru/inflation/v1/tx.ts new file mode 100644 index 00000000..fa19229a --- /dev/null +++ b/src/protojs/nibiru/inflation/v1/tx.ts @@ -0,0 +1,522 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../../cosmos/base/v1beta1/coin"; +import { InflationDistribution } from "./inflation"; + +/** MsgToggleInflation defines a message to enable or disable inflation. */ +export interface MsgToggleInflation { + sender: string; + enable: boolean; +} + +export interface MsgEditInflationParams { + sender: string; + inflationEnabled: boolean; + polynomialFactors: string[]; + inflationDistribution?: InflationDistribution; + epochsPerPeriod: string; + periodsPerYear: string; + maxPeriod: string; +} + +export interface MsgToggleInflationResponse { +} + +export interface MsgEditInflationParamsResponse { +} + +/** MsgBurn: allows burning of any token */ +export interface MsgBurn { + sender: string; + coin?: Coin; +} + +export interface MsgBurnResponse { +} + +function createBaseMsgToggleInflation(): MsgToggleInflation { + return { sender: "", enable: false }; +} + +export const MsgToggleInflation = { + encode(message: MsgToggleInflation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.enable === true) { + writer.uint32(16).bool(message.enable); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgToggleInflation { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgToggleInflation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sender = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enable = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgToggleInflation { + return { + sender: isSet(object.sender) ? String(object.sender) : "", + enable: isSet(object.enable) ? Boolean(object.enable) : false, + }; + }, + + toJSON(message: MsgToggleInflation): unknown { + const obj: any = {}; + message.sender !== undefined && (obj.sender = message.sender); + message.enable !== undefined && (obj.enable = message.enable); + return obj; + }, + + create, I>>(base?: I): MsgToggleInflation { + return MsgToggleInflation.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): MsgToggleInflation { + const message = createBaseMsgToggleInflation(); + message.sender = object.sender ?? ""; + message.enable = object.enable ?? false; + return message; + }, +}; + +function createBaseMsgEditInflationParams(): MsgEditInflationParams { + return { + sender: "", + inflationEnabled: false, + polynomialFactors: [], + inflationDistribution: undefined, + epochsPerPeriod: "", + periodsPerYear: "", + maxPeriod: "", + }; +} + +export const MsgEditInflationParams = { + encode(message: MsgEditInflationParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.inflationEnabled === true) { + writer.uint32(16).bool(message.inflationEnabled); + } + for (const v of message.polynomialFactors) { + writer.uint32(26).string(v!); + } + if (message.inflationDistribution !== undefined) { + InflationDistribution.encode(message.inflationDistribution, writer.uint32(34).fork()).ldelim(); + } + if (message.epochsPerPeriod !== "") { + writer.uint32(42).string(message.epochsPerPeriod); + } + if (message.periodsPerYear !== "") { + writer.uint32(50).string(message.periodsPerYear); + } + if (message.maxPeriod !== "") { + writer.uint32(58).string(message.maxPeriod); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgEditInflationParams { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgEditInflationParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sender = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.inflationEnabled = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.polynomialFactors.push(reader.string()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.inflationDistribution = InflationDistribution.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.epochsPerPeriod = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.periodsPerYear = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.maxPeriod = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgEditInflationParams { + return { + sender: isSet(object.sender) ? String(object.sender) : "", + inflationEnabled: isSet(object.inflationEnabled) ? Boolean(object.inflationEnabled) : false, + polynomialFactors: Array.isArray(object?.polynomialFactors) + ? object.polynomialFactors.map((e: any) => String(e)) + : [], + inflationDistribution: isSet(object.inflationDistribution) + ? InflationDistribution.fromJSON(object.inflationDistribution) + : undefined, + epochsPerPeriod: isSet(object.epochsPerPeriod) ? String(object.epochsPerPeriod) : "", + periodsPerYear: isSet(object.periodsPerYear) ? String(object.periodsPerYear) : "", + maxPeriod: isSet(object.maxPeriod) ? String(object.maxPeriod) : "", + }; + }, + + toJSON(message: MsgEditInflationParams): unknown { + const obj: any = {}; + message.sender !== undefined && (obj.sender = message.sender); + message.inflationEnabled !== undefined && (obj.inflationEnabled = message.inflationEnabled); + if (message.polynomialFactors) { + obj.polynomialFactors = message.polynomialFactors.map((e) => e); + } else { + obj.polynomialFactors = []; + } + message.inflationDistribution !== undefined && (obj.inflationDistribution = message.inflationDistribution + ? InflationDistribution.toJSON(message.inflationDistribution) + : undefined); + message.epochsPerPeriod !== undefined && (obj.epochsPerPeriod = message.epochsPerPeriod); + message.periodsPerYear !== undefined && (obj.periodsPerYear = message.periodsPerYear); + message.maxPeriod !== undefined && (obj.maxPeriod = message.maxPeriod); + return obj; + }, + + create, I>>(base?: I): MsgEditInflationParams { + return MsgEditInflationParams.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): MsgEditInflationParams { + const message = createBaseMsgEditInflationParams(); + message.sender = object.sender ?? ""; + message.inflationEnabled = object.inflationEnabled ?? false; + message.polynomialFactors = object.polynomialFactors?.map((e) => e) || []; + message.inflationDistribution = + (object.inflationDistribution !== undefined && object.inflationDistribution !== null) + ? InflationDistribution.fromPartial(object.inflationDistribution) + : undefined; + message.epochsPerPeriod = object.epochsPerPeriod ?? ""; + message.periodsPerYear = object.periodsPerYear ?? ""; + message.maxPeriod = object.maxPeriod ?? ""; + return message; + }, +}; + +function createBaseMsgToggleInflationResponse(): MsgToggleInflationResponse { + return {}; +} + +export const MsgToggleInflationResponse = { + encode(_: MsgToggleInflationResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgToggleInflationResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgToggleInflationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgToggleInflationResponse { + return {}; + }, + + toJSON(_: MsgToggleInflationResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgToggleInflationResponse { + return MsgToggleInflationResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(_: I): MsgToggleInflationResponse { + const message = createBaseMsgToggleInflationResponse(); + return message; + }, +}; + +function createBaseMsgEditInflationParamsResponse(): MsgEditInflationParamsResponse { + return {}; +} + +export const MsgEditInflationParamsResponse = { + encode(_: MsgEditInflationParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgEditInflationParamsResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgEditInflationParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgEditInflationParamsResponse { + return {}; + }, + + toJSON(_: MsgEditInflationParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgEditInflationParamsResponse { + return MsgEditInflationParamsResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(_: I): MsgEditInflationParamsResponse { + const message = createBaseMsgEditInflationParamsResponse(); + return message; + }, +}; + +function createBaseMsgBurn(): MsgBurn { + return { sender: "", coin: undefined }; +} + +export const MsgBurn = { + encode(message: MsgBurn, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.coin !== undefined) { + Coin.encode(message.coin, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgBurn { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgBurn(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sender = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.coin = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgBurn { + return { + sender: isSet(object.sender) ? String(object.sender) : "", + coin: isSet(object.coin) ? Coin.fromJSON(object.coin) : undefined, + }; + }, + + toJSON(message: MsgBurn): unknown { + const obj: any = {}; + message.sender !== undefined && (obj.sender = message.sender); + message.coin !== undefined && (obj.coin = message.coin ? Coin.toJSON(message.coin) : undefined); + return obj; + }, + + create, I>>(base?: I): MsgBurn { + return MsgBurn.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): MsgBurn { + const message = createBaseMsgBurn(); + message.sender = object.sender ?? ""; + message.coin = (object.coin !== undefined && object.coin !== null) ? Coin.fromPartial(object.coin) : undefined; + return message; + }, +}; + +function createBaseMsgBurnResponse(): MsgBurnResponse { + return {}; +} + +export const MsgBurnResponse = { + encode(_: MsgBurnResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgBurnResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgBurnResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgBurnResponse { + return {}; + }, + + toJSON(_: MsgBurnResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgBurnResponse { + return MsgBurnResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(_: I): MsgBurnResponse { + const message = createBaseMsgBurnResponse(); + return message; + }, +}; + +export interface Msg { + /** ToggleInflation defines a method to enable or disable inflation. */ + ToggleInflation(request: MsgToggleInflation): Promise; + /** EditInflationParams defines a method to edit the inflation params. */ + EditInflationParams(request: MsgEditInflationParams): Promise; +} + +export const MsgServiceName = "nibiru.inflation.v1.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.ToggleInflation = this.ToggleInflation.bind(this); + this.EditInflationParams = this.EditInflationParams.bind(this); + } + ToggleInflation(request: MsgToggleInflation): Promise { + const data = MsgToggleInflation.encode(request).finish(); + const promise = this.rpc.request(this.service, "ToggleInflation", data); + return promise.then((data) => MsgToggleInflationResponse.decode(_m0.Reader.create(data))); + } + + EditInflationParams(request: MsgEditInflationParams): Promise { + const data = MsgEditInflationParams.encode(request).finish(); + const promise = this.rpc.request(this.service, "EditInflationParams", data); + return promise.then((data) => MsgEditInflationParamsResponse.decode(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/nibiru/oracle/v1/event.ts b/src/protojs/nibiru/oracle/v1/event.ts new file mode 100644 index 00000000..c717fec6 --- /dev/null +++ b/src/protojs/nibiru/oracle/v1/event.ts @@ -0,0 +1,543 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { ExchangeRateTuple } from "./oracle"; + +/** Emitted when a price is posted */ +export interface EventPriceUpdate { + pair: string; + price: string; + timestampMs: Long; +} + +/** Emitted when a valoper delegates oracle voting rights to a feeder address. */ +export interface EventDelegateFeederConsent { + /** Validator is the Bech32 address that is delegating voting rights. */ + validator: string; + /** + * Feeder is the delegate or representative that will be able to send + * vote and prevote transaction messages. + */ + feeder: string; +} + +/** Emitted by MsgAggregateExchangeVote when an aggregate vote is added to state */ +export interface EventAggregateVote { + /** Validator is the Bech32 address to which the vote will be credited. */ + validator: string; + /** + * Feeder is the delegate or representative that will send vote and prevote + * transaction messages on behalf of the voting validator. + */ + feeder: string; + prices: ExchangeRateTuple[]; +} + +/** + * Emitted by MsgAggregateExchangePrevote when an aggregate prevote is added + * to state + */ +export interface EventAggregatePrevote { + /** Validator is the Bech32 address to which the vote will be credited. */ + validator: string; + /** + * Feeder is the delegate or representative that will send vote and prevote + * transaction messages on behalf of the voting validator. + */ + feeder: string; +} + +export interface EventValidatorPerformance { + /** Validator is the Bech32 address to which the vote will be credited. */ + validator: string; + /** Tendermint consensus voting power */ + votingPower: Long; + /** + * RewardWeight: Weight of rewards the validator should receive in units of + * consensus power. + */ + rewardWeight: Long; + /** Number of valid votes for which the validator will be rewarded */ + winCount: Long; + /** Number of abstained votes for which there will be no reward or punishment */ + abstainCount: Long; + /** Number of invalid/punishable votes */ + missCount: Long; +} + +function createBaseEventPriceUpdate(): EventPriceUpdate { + return { pair: "", price: "", timestampMs: Long.ZERO }; +} + +export const EventPriceUpdate = { + encode(message: EventPriceUpdate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pair !== "") { + writer.uint32(10).string(message.pair); + } + if (message.price !== "") { + writer.uint32(18).string(message.price); + } + if (!message.timestampMs.isZero()) { + writer.uint32(24).int64(message.timestampMs); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventPriceUpdate { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventPriceUpdate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pair = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.price = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.timestampMs = reader.int64() as Long; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventPriceUpdate { + return { + pair: isSet(object.pair) ? String(object.pair) : "", + price: isSet(object.price) ? String(object.price) : "", + timestampMs: isSet(object.timestampMs) ? Long.fromValue(object.timestampMs) : Long.ZERO, + }; + }, + + toJSON(message: EventPriceUpdate): unknown { + const obj: any = {}; + message.pair !== undefined && (obj.pair = message.pair); + message.price !== undefined && (obj.price = message.price); + message.timestampMs !== undefined && (obj.timestampMs = (message.timestampMs || Long.ZERO).toString()); + return obj; + }, + + create, I>>(base?: I): EventPriceUpdate { + return EventPriceUpdate.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): EventPriceUpdate { + const message = createBaseEventPriceUpdate(); + message.pair = object.pair ?? ""; + message.price = object.price ?? ""; + message.timestampMs = (object.timestampMs !== undefined && object.timestampMs !== null) + ? Long.fromValue(object.timestampMs) + : Long.ZERO; + return message; + }, +}; + +function createBaseEventDelegateFeederConsent(): EventDelegateFeederConsent { + return { validator: "", feeder: "" }; +} + +export const EventDelegateFeederConsent = { + encode(message: EventDelegateFeederConsent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.feeder !== "") { + writer.uint32(18).string(message.feeder); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventDelegateFeederConsent { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventDelegateFeederConsent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.feeder = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventDelegateFeederConsent { + return { + validator: isSet(object.validator) ? String(object.validator) : "", + feeder: isSet(object.feeder) ? String(object.feeder) : "", + }; + }, + + toJSON(message: EventDelegateFeederConsent): unknown { + const obj: any = {}; + message.validator !== undefined && (obj.validator = message.validator); + message.feeder !== undefined && (obj.feeder = message.feeder); + return obj; + }, + + create, I>>(base?: I): EventDelegateFeederConsent { + return EventDelegateFeederConsent.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): EventDelegateFeederConsent { + const message = createBaseEventDelegateFeederConsent(); + message.validator = object.validator ?? ""; + message.feeder = object.feeder ?? ""; + return message; + }, +}; + +function createBaseEventAggregateVote(): EventAggregateVote { + return { validator: "", feeder: "", prices: [] }; +} + +export const EventAggregateVote = { + encode(message: EventAggregateVote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.feeder !== "") { + writer.uint32(18).string(message.feeder); + } + for (const v of message.prices) { + ExchangeRateTuple.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventAggregateVote { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventAggregateVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.feeder = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.prices.push(ExchangeRateTuple.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventAggregateVote { + return { + validator: isSet(object.validator) ? String(object.validator) : "", + feeder: isSet(object.feeder) ? String(object.feeder) : "", + prices: Array.isArray(object?.prices) ? object.prices.map((e: any) => ExchangeRateTuple.fromJSON(e)) : [], + }; + }, + + toJSON(message: EventAggregateVote): unknown { + const obj: any = {}; + message.validator !== undefined && (obj.validator = message.validator); + message.feeder !== undefined && (obj.feeder = message.feeder); + if (message.prices) { + obj.prices = message.prices.map((e) => e ? ExchangeRateTuple.toJSON(e) : undefined); + } else { + obj.prices = []; + } + return obj; + }, + + create, I>>(base?: I): EventAggregateVote { + return EventAggregateVote.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): EventAggregateVote { + const message = createBaseEventAggregateVote(); + message.validator = object.validator ?? ""; + message.feeder = object.feeder ?? ""; + message.prices = object.prices?.map((e) => ExchangeRateTuple.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEventAggregatePrevote(): EventAggregatePrevote { + return { validator: "", feeder: "" }; +} + +export const EventAggregatePrevote = { + encode(message: EventAggregatePrevote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.feeder !== "") { + writer.uint32(18).string(message.feeder); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventAggregatePrevote { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventAggregatePrevote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.feeder = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventAggregatePrevote { + return { + validator: isSet(object.validator) ? String(object.validator) : "", + feeder: isSet(object.feeder) ? String(object.feeder) : "", + }; + }, + + toJSON(message: EventAggregatePrevote): unknown { + const obj: any = {}; + message.validator !== undefined && (obj.validator = message.validator); + message.feeder !== undefined && (obj.feeder = message.feeder); + return obj; + }, + + create, I>>(base?: I): EventAggregatePrevote { + return EventAggregatePrevote.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): EventAggregatePrevote { + const message = createBaseEventAggregatePrevote(); + message.validator = object.validator ?? ""; + message.feeder = object.feeder ?? ""; + return message; + }, +}; + +function createBaseEventValidatorPerformance(): EventValidatorPerformance { + return { + validator: "", + votingPower: Long.ZERO, + rewardWeight: Long.ZERO, + winCount: Long.ZERO, + abstainCount: Long.ZERO, + missCount: Long.ZERO, + }; +} + +export const EventValidatorPerformance = { + encode(message: EventValidatorPerformance, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (!message.votingPower.isZero()) { + writer.uint32(16).int64(message.votingPower); + } + if (!message.rewardWeight.isZero()) { + writer.uint32(24).int64(message.rewardWeight); + } + if (!message.winCount.isZero()) { + writer.uint32(32).int64(message.winCount); + } + if (!message.abstainCount.isZero()) { + writer.uint32(40).int64(message.abstainCount); + } + if (!message.missCount.isZero()) { + writer.uint32(48).int64(message.missCount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventValidatorPerformance { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventValidatorPerformance(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.votingPower = reader.int64() as Long; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.rewardWeight = reader.int64() as Long; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.winCount = reader.int64() as Long; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.abstainCount = reader.int64() as Long; + continue; + case 6: + if (tag !== 48) { + break; + } + + message.missCount = reader.int64() as Long; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventValidatorPerformance { + return { + validator: isSet(object.validator) ? String(object.validator) : "", + votingPower: isSet(object.votingPower) ? Long.fromValue(object.votingPower) : Long.ZERO, + rewardWeight: isSet(object.rewardWeight) ? Long.fromValue(object.rewardWeight) : Long.ZERO, + winCount: isSet(object.winCount) ? Long.fromValue(object.winCount) : Long.ZERO, + abstainCount: isSet(object.abstainCount) ? Long.fromValue(object.abstainCount) : Long.ZERO, + missCount: isSet(object.missCount) ? Long.fromValue(object.missCount) : Long.ZERO, + }; + }, + + toJSON(message: EventValidatorPerformance): unknown { + const obj: any = {}; + message.validator !== undefined && (obj.validator = message.validator); + message.votingPower !== undefined && (obj.votingPower = (message.votingPower || Long.ZERO).toString()); + message.rewardWeight !== undefined && (obj.rewardWeight = (message.rewardWeight || Long.ZERO).toString()); + message.winCount !== undefined && (obj.winCount = (message.winCount || Long.ZERO).toString()); + message.abstainCount !== undefined && (obj.abstainCount = (message.abstainCount || Long.ZERO).toString()); + message.missCount !== undefined && (obj.missCount = (message.missCount || Long.ZERO).toString()); + return obj; + }, + + create, I>>(base?: I): EventValidatorPerformance { + return EventValidatorPerformance.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): EventValidatorPerformance { + const message = createBaseEventValidatorPerformance(); + message.validator = object.validator ?? ""; + message.votingPower = (object.votingPower !== undefined && object.votingPower !== null) + ? Long.fromValue(object.votingPower) + : Long.ZERO; + message.rewardWeight = (object.rewardWeight !== undefined && object.rewardWeight !== null) + ? Long.fromValue(object.rewardWeight) + : Long.ZERO; + message.winCount = (object.winCount !== undefined && object.winCount !== null) + ? Long.fromValue(object.winCount) + : Long.ZERO; + message.abstainCount = (object.abstainCount !== undefined && object.abstainCount !== null) + ? Long.fromValue(object.abstainCount) + : Long.ZERO; + message.missCount = (object.missCount !== undefined && object.missCount !== null) + ? Long.fromValue(object.missCount) + : Long.ZERO; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/nibiru/oracle/v1/genesis.ts b/src/protojs/nibiru/oracle/v1/genesis.ts new file mode 100644 index 00000000..4d167904 --- /dev/null +++ b/src/protojs/nibiru/oracle/v1/genesis.ts @@ -0,0 +1,406 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { AggregateExchangeRatePrevote, AggregateExchangeRateVote, ExchangeRateTuple, Params, Rewards } from "./oracle"; + +/** GenesisState defines the oracle module's genesis state. */ +export interface GenesisState { + params?: Params; + feederDelegations: FeederDelegation[]; + exchangeRates: ExchangeRateTuple[]; + missCounters: MissCounter[]; + aggregateExchangeRatePrevotes: AggregateExchangeRatePrevote[]; + aggregateExchangeRateVotes: AggregateExchangeRateVote[]; + pairs: string[]; + rewards: Rewards[]; +} + +/** + * FeederDelegation is the address for where oracle feeder authority are + * delegated to. By default this struct is only used at genesis to feed in + * default feeder addresses. + */ +export interface FeederDelegation { + feederAddress: string; + validatorAddress: string; +} + +/** + * MissCounter defines an miss counter and validator address pair used in + * oracle module's genesis state + */ +export interface MissCounter { + validatorAddress: string; + missCounter: Long; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + feederDelegations: [], + exchangeRates: [], + missCounters: [], + aggregateExchangeRatePrevotes: [], + aggregateExchangeRateVotes: [], + pairs: [], + rewards: [], + }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.feederDelegations) { + FeederDelegation.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.exchangeRates) { + ExchangeRateTuple.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.missCounters) { + MissCounter.encode(v!, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.aggregateExchangeRatePrevotes) { + AggregateExchangeRatePrevote.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.aggregateExchangeRateVotes) { + AggregateExchangeRateVote.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.pairs) { + writer.uint32(58).string(v!); + } + for (const v of message.rewards) { + Rewards.encode(v!, writer.uint32(66).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.feederDelegations.push(FeederDelegation.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.exchangeRates.push(ExchangeRateTuple.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.missCounters.push(MissCounter.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.aggregateExchangeRatePrevotes.push(AggregateExchangeRatePrevote.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.aggregateExchangeRateVotes.push(AggregateExchangeRateVote.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.pairs.push(reader.string()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.rewards.push(Rewards.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + feederDelegations: Array.isArray(object?.feederDelegations) + ? object.feederDelegations.map((e: any) => FeederDelegation.fromJSON(e)) + : [], + exchangeRates: Array.isArray(object?.exchangeRates) + ? object.exchangeRates.map((e: any) => ExchangeRateTuple.fromJSON(e)) + : [], + missCounters: Array.isArray(object?.missCounters) + ? object.missCounters.map((e: any) => MissCounter.fromJSON(e)) + : [], + aggregateExchangeRatePrevotes: Array.isArray(object?.aggregateExchangeRatePrevotes) + ? object.aggregateExchangeRatePrevotes.map((e: any) => AggregateExchangeRatePrevote.fromJSON(e)) + : [], + aggregateExchangeRateVotes: Array.isArray(object?.aggregateExchangeRateVotes) + ? object.aggregateExchangeRateVotes.map((e: any) => AggregateExchangeRateVote.fromJSON(e)) + : [], + pairs: Array.isArray(object?.pairs) + ? object.pairs.map((e: any) => String(e)) + : [], + rewards: Array.isArray(object?.rewards) ? object.rewards.map((e: any) => Rewards.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + if (message.feederDelegations) { + obj.feederDelegations = message.feederDelegations.map((e) => e ? FeederDelegation.toJSON(e) : undefined); + } else { + obj.feederDelegations = []; + } + if (message.exchangeRates) { + obj.exchangeRates = message.exchangeRates.map((e) => e ? ExchangeRateTuple.toJSON(e) : undefined); + } else { + obj.exchangeRates = []; + } + if (message.missCounters) { + obj.missCounters = message.missCounters.map((e) => e ? MissCounter.toJSON(e) : undefined); + } else { + obj.missCounters = []; + } + if (message.aggregateExchangeRatePrevotes) { + obj.aggregateExchangeRatePrevotes = message.aggregateExchangeRatePrevotes.map((e) => + e ? AggregateExchangeRatePrevote.toJSON(e) : undefined + ); + } else { + obj.aggregateExchangeRatePrevotes = []; + } + if (message.aggregateExchangeRateVotes) { + obj.aggregateExchangeRateVotes = message.aggregateExchangeRateVotes.map((e) => + e ? AggregateExchangeRateVote.toJSON(e) : undefined + ); + } else { + obj.aggregateExchangeRateVotes = []; + } + if (message.pairs) { + obj.pairs = message.pairs.map((e) => e); + } else { + obj.pairs = []; + } + if (message.rewards) { + obj.rewards = message.rewards.map((e) => e ? Rewards.toJSON(e) : undefined); + } else { + obj.rewards = []; + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + message.feederDelegations = object.feederDelegations?.map((e) => FeederDelegation.fromPartial(e)) || []; + message.exchangeRates = object.exchangeRates?.map((e) => ExchangeRateTuple.fromPartial(e)) || []; + message.missCounters = object.missCounters?.map((e) => MissCounter.fromPartial(e)) || []; + message.aggregateExchangeRatePrevotes = + object.aggregateExchangeRatePrevotes?.map((e) => AggregateExchangeRatePrevote.fromPartial(e)) || []; + message.aggregateExchangeRateVotes = + object.aggregateExchangeRateVotes?.map((e) => AggregateExchangeRateVote.fromPartial(e)) || []; + message.pairs = object.pairs?.map((e) => e) || []; + message.rewards = object.rewards?.map((e) => Rewards.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFeederDelegation(): FeederDelegation { + return { feederAddress: "", validatorAddress: "" }; +} + +export const FeederDelegation = { + encode(message: FeederDelegation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.feederAddress !== "") { + writer.uint32(10).string(message.feederAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): FeederDelegation { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeederDelegation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.feederAddress = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validatorAddress = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeederDelegation { + return { + feederAddress: isSet(object.feederAddress) ? String(object.feederAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + + toJSON(message: FeederDelegation): unknown { + const obj: any = {}; + message.feederAddress !== undefined && (obj.feederAddress = message.feederAddress); + message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); + return obj; + }, + + create, I>>(base?: I): FeederDelegation { + return FeederDelegation.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): FeederDelegation { + const message = createBaseFeederDelegation(); + message.feederAddress = object.feederAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; + +function createBaseMissCounter(): MissCounter { + return { validatorAddress: "", missCounter: Long.UZERO }; +} + +export const MissCounter = { + encode(message: MissCounter, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (!message.missCounter.isZero()) { + writer.uint32(16).uint64(message.missCounter); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MissCounter { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMissCounter(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddress = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.missCounter = reader.uint64() as Long; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MissCounter { + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + missCounter: isSet(object.missCounter) ? Long.fromValue(object.missCounter) : Long.UZERO, + }; + }, + + toJSON(message: MissCounter): unknown { + const obj: any = {}; + message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); + message.missCounter !== undefined && (obj.missCounter = (message.missCounter || Long.UZERO).toString()); + return obj; + }, + + create, I>>(base?: I): MissCounter { + return MissCounter.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): MissCounter { + const message = createBaseMissCounter(); + message.validatorAddress = object.validatorAddress ?? ""; + message.missCounter = (object.missCounter !== undefined && object.missCounter !== null) + ? Long.fromValue(object.missCounter) + : Long.UZERO; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/nibiru/oracle/v1/oracle.ts b/src/protojs/nibiru/oracle/v1/oracle.ts new file mode 100644 index 00000000..e95f78d4 --- /dev/null +++ b/src/protojs/nibiru/oracle/v1/oracle.ts @@ -0,0 +1,741 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../../cosmos/base/v1beta1/coin"; +import { Duration } from "../../../google/protobuf/duration"; + +/** Params defines the module parameters for the x/oracle module. */ +export interface Params { + /** VotePeriod defines the number of blocks during which voting takes place. */ + votePeriod: Long; + /** + * VoteThreshold specifies the minimum proportion of votes that must be + * received for a ballot to pass. + */ + voteThreshold: string; + /** + * RewardBand defines a maxium divergence that a price vote can have from the + * weighted median in the ballot. If a vote lies within the valid range + * defined by: + * Ī¼ := weightedMedian, + * validRange := Ī¼ Ā± (Ī¼ * rewardBand / 2), + * then rewards are added to the validator performance. + * Note that if the reward band is smaller than 1 standard + * deviation, the band is taken to be 1 standard deviation.a price + */ + rewardBand: string; + /** + * The set of whitelisted markets, or asset pairs, for the module. + * Ex. '["unibi:uusd","ubtc:uusd"]' + */ + whitelist: string[]; + /** + * SlashFraction returns the proportion of an oracle's stake that gets + * slashed in the event of slashing. `SlashFraction` specifies the exact + * penalty for failing a voting period. + */ + slashFraction: string; + /** + * SlashWindow returns the number of voting periods that specify a + * "slash window". After each slash window, all oracles that have missed more + * than the penalty threshold are slashed. Missing the penalty threshold is + * synonymous with submitting fewer valid votes than `MinValidPerWindow`. + */ + slashWindow: Long; + minValidPerWindow: string; + /** + * Amount of time to look back for TWAP calculations. + * Ex: "900.000000069s" corresponds to 900 seconds and 69 nanoseconds in JSON. + */ + twapLookbackWindow?: Duration; + /** + * The minimum number of voters (i.e. oracle validators) per pair for it to be + * considered a passing ballot. Recommended at least 4. + */ + minVoters: Long; + /** The validator fee ratio that is given to validators every epoch. */ + validatorFeeRatio: string; + expirationBlocks: Long; +} + +/** + * Struct for aggregate prevoting on the ExchangeRateVote. + * The purpose of aggregate prevote is to hide vote exchange rates with hash + * which is formatted as hex string in + * SHA256("{salt}:({pair},{exchange_rate})|...|({pair},{exchange_rate}):{voter}") + */ +export interface AggregateExchangeRatePrevote { + hash: string; + voter: string; + submitBlock: Long; +} + +/** + * MsgAggregateExchangeRateVote - struct for voting on + * the exchange rates different assets. + */ +export interface AggregateExchangeRateVote { + exchangeRateTuples: ExchangeRateTuple[]; + voter: string; +} + +/** ExchangeRateTuple - struct to store interpreted exchange rates data to store */ +export interface ExchangeRateTuple { + pair: string; + exchangeRate: string; +} + +export interface DatedPrice { + exchangeRate: string; + createdBlock: Long; +} + +/** + * Rewards defines a credit object towards validators + * which provide prices faithfully for different pairs. + */ +export interface Rewards { + /** id uniquely identifies the rewards instance of the pair */ + id: Long; + /** + * vote_periods defines the vote periods left in which rewards will be + * distributed. + */ + votePeriods: Long; + /** Coins defines the amount of coins to distribute in a single vote period. */ + coins: Coin[]; +} + +function createBaseParams(): Params { + return { + votePeriod: Long.UZERO, + voteThreshold: "", + rewardBand: "", + whitelist: [], + slashFraction: "", + slashWindow: Long.UZERO, + minValidPerWindow: "", + twapLookbackWindow: undefined, + minVoters: Long.UZERO, + validatorFeeRatio: "", + expirationBlocks: Long.UZERO, + }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (!message.votePeriod.isZero()) { + writer.uint32(8).uint64(message.votePeriod); + } + if (message.voteThreshold !== "") { + writer.uint32(18).string(message.voteThreshold); + } + if (message.rewardBand !== "") { + writer.uint32(26).string(message.rewardBand); + } + for (const v of message.whitelist) { + writer.uint32(34).string(v!); + } + if (message.slashFraction !== "") { + writer.uint32(42).string(message.slashFraction); + } + if (!message.slashWindow.isZero()) { + writer.uint32(48).uint64(message.slashWindow); + } + if (message.minValidPerWindow !== "") { + writer.uint32(58).string(message.minValidPerWindow); + } + if (message.twapLookbackWindow !== undefined) { + Duration.encode(message.twapLookbackWindow, writer.uint32(66).fork()).ldelim(); + } + if (!message.minVoters.isZero()) { + writer.uint32(72).uint64(message.minVoters); + } + if (message.validatorFeeRatio !== "") { + writer.uint32(82).string(message.validatorFeeRatio); + } + if (!message.expirationBlocks.isZero()) { + writer.uint32(88).uint64(message.expirationBlocks); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.votePeriod = reader.uint64() as Long; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voteThreshold = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.rewardBand = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.whitelist.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.slashFraction = reader.string(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.slashWindow = reader.uint64() as Long; + continue; + case 7: + if (tag !== 58) { + break; + } + + message.minValidPerWindow = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.twapLookbackWindow = Duration.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.minVoters = reader.uint64() as Long; + continue; + case 10: + if (tag !== 82) { + break; + } + + message.validatorFeeRatio = reader.string(); + continue; + case 11: + if (tag !== 88) { + break; + } + + message.expirationBlocks = reader.uint64() as Long; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + votePeriod: isSet(object.votePeriod) ? Long.fromValue(object.votePeriod) : Long.UZERO, + voteThreshold: isSet(object.voteThreshold) ? String(object.voteThreshold) : "", + rewardBand: isSet(object.rewardBand) ? String(object.rewardBand) : "", + whitelist: Array.isArray(object?.whitelist) ? object.whitelist.map((e: any) => String(e)) : [], + slashFraction: isSet(object.slashFraction) ? String(object.slashFraction) : "", + slashWindow: isSet(object.slashWindow) ? Long.fromValue(object.slashWindow) : Long.UZERO, + minValidPerWindow: isSet(object.minValidPerWindow) ? String(object.minValidPerWindow) : "", + twapLookbackWindow: isSet(object.twapLookbackWindow) ? Duration.fromJSON(object.twapLookbackWindow) : undefined, + minVoters: isSet(object.minVoters) ? Long.fromValue(object.minVoters) : Long.UZERO, + validatorFeeRatio: isSet(object.validatorFeeRatio) ? String(object.validatorFeeRatio) : "", + expirationBlocks: isSet(object.expirationBlocks) ? Long.fromValue(object.expirationBlocks) : Long.UZERO, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + message.votePeriod !== undefined && (obj.votePeriod = (message.votePeriod || Long.UZERO).toString()); + message.voteThreshold !== undefined && (obj.voteThreshold = message.voteThreshold); + message.rewardBand !== undefined && (obj.rewardBand = message.rewardBand); + if (message.whitelist) { + obj.whitelist = message.whitelist.map((e) => e); + } else { + obj.whitelist = []; + } + message.slashFraction !== undefined && (obj.slashFraction = message.slashFraction); + message.slashWindow !== undefined && (obj.slashWindow = (message.slashWindow || Long.UZERO).toString()); + message.minValidPerWindow !== undefined && (obj.minValidPerWindow = message.minValidPerWindow); + message.twapLookbackWindow !== undefined && + (obj.twapLookbackWindow = message.twapLookbackWindow ? Duration.toJSON(message.twapLookbackWindow) : undefined); + message.minVoters !== undefined && (obj.minVoters = (message.minVoters || Long.UZERO).toString()); + message.validatorFeeRatio !== undefined && (obj.validatorFeeRatio = message.validatorFeeRatio); + message.expirationBlocks !== undefined && + (obj.expirationBlocks = (message.expirationBlocks || Long.UZERO).toString()); + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.votePeriod = (object.votePeriod !== undefined && object.votePeriod !== null) + ? Long.fromValue(object.votePeriod) + : Long.UZERO; + message.voteThreshold = object.voteThreshold ?? ""; + message.rewardBand = object.rewardBand ?? ""; + message.whitelist = object.whitelist?.map((e) => e) || []; + message.slashFraction = object.slashFraction ?? ""; + message.slashWindow = (object.slashWindow !== undefined && object.slashWindow !== null) + ? Long.fromValue(object.slashWindow) + : Long.UZERO; + message.minValidPerWindow = object.minValidPerWindow ?? ""; + message.twapLookbackWindow = (object.twapLookbackWindow !== undefined && object.twapLookbackWindow !== null) + ? Duration.fromPartial(object.twapLookbackWindow) + : undefined; + message.minVoters = (object.minVoters !== undefined && object.minVoters !== null) + ? Long.fromValue(object.minVoters) + : Long.UZERO; + message.validatorFeeRatio = object.validatorFeeRatio ?? ""; + message.expirationBlocks = (object.expirationBlocks !== undefined && object.expirationBlocks !== null) + ? Long.fromValue(object.expirationBlocks) + : Long.UZERO; + return message; + }, +}; + +function createBaseAggregateExchangeRatePrevote(): AggregateExchangeRatePrevote { + return { hash: "", voter: "", submitBlock: Long.UZERO }; +} + +export const AggregateExchangeRatePrevote = { + encode(message: AggregateExchangeRatePrevote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.hash !== "") { + writer.uint32(10).string(message.hash); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (!message.submitBlock.isZero()) { + writer.uint32(24).uint64(message.submitBlock); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AggregateExchangeRatePrevote { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAggregateExchangeRatePrevote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.hash = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.submitBlock = reader.uint64() as Long; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): AggregateExchangeRatePrevote { + return { + hash: isSet(object.hash) ? String(object.hash) : "", + voter: isSet(object.voter) ? String(object.voter) : "", + submitBlock: isSet(object.submitBlock) ? Long.fromValue(object.submitBlock) : Long.UZERO, + }; + }, + + toJSON(message: AggregateExchangeRatePrevote): unknown { + const obj: any = {}; + message.hash !== undefined && (obj.hash = message.hash); + message.voter !== undefined && (obj.voter = message.voter); + message.submitBlock !== undefined && (obj.submitBlock = (message.submitBlock || Long.UZERO).toString()); + return obj; + }, + + create, I>>(base?: I): AggregateExchangeRatePrevote { + return AggregateExchangeRatePrevote.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): AggregateExchangeRatePrevote { + const message = createBaseAggregateExchangeRatePrevote(); + message.hash = object.hash ?? ""; + message.voter = object.voter ?? ""; + message.submitBlock = (object.submitBlock !== undefined && object.submitBlock !== null) + ? Long.fromValue(object.submitBlock) + : Long.UZERO; + return message; + }, +}; + +function createBaseAggregateExchangeRateVote(): AggregateExchangeRateVote { + return { exchangeRateTuples: [], voter: "" }; +} + +export const AggregateExchangeRateVote = { + encode(message: AggregateExchangeRateVote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.exchangeRateTuples) { + ExchangeRateTuple.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AggregateExchangeRateVote { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAggregateExchangeRateVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.exchangeRateTuples.push(ExchangeRateTuple.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): AggregateExchangeRateVote { + return { + exchangeRateTuples: Array.isArray(object?.exchangeRateTuples) + ? object.exchangeRateTuples.map((e: any) => ExchangeRateTuple.fromJSON(e)) + : [], + voter: isSet(object.voter) ? String(object.voter) : "", + }; + }, + + toJSON(message: AggregateExchangeRateVote): unknown { + const obj: any = {}; + if (message.exchangeRateTuples) { + obj.exchangeRateTuples = message.exchangeRateTuples.map((e) => e ? ExchangeRateTuple.toJSON(e) : undefined); + } else { + obj.exchangeRateTuples = []; + } + message.voter !== undefined && (obj.voter = message.voter); + return obj; + }, + + create, I>>(base?: I): AggregateExchangeRateVote { + return AggregateExchangeRateVote.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): AggregateExchangeRateVote { + const message = createBaseAggregateExchangeRateVote(); + message.exchangeRateTuples = object.exchangeRateTuples?.map((e) => ExchangeRateTuple.fromPartial(e)) || []; + message.voter = object.voter ?? ""; + return message; + }, +}; + +function createBaseExchangeRateTuple(): ExchangeRateTuple { + return { pair: "", exchangeRate: "" }; +} + +export const ExchangeRateTuple = { + encode(message: ExchangeRateTuple, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pair !== "") { + writer.uint32(10).string(message.pair); + } + if (message.exchangeRate !== "") { + writer.uint32(18).string(message.exchangeRate); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ExchangeRateTuple { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExchangeRateTuple(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pair = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.exchangeRate = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExchangeRateTuple { + return { + pair: isSet(object.pair) ? String(object.pair) : "", + exchangeRate: isSet(object.exchangeRate) ? String(object.exchangeRate) : "", + }; + }, + + toJSON(message: ExchangeRateTuple): unknown { + const obj: any = {}; + message.pair !== undefined && (obj.pair = message.pair); + message.exchangeRate !== undefined && (obj.exchangeRate = message.exchangeRate); + return obj; + }, + + create, I>>(base?: I): ExchangeRateTuple { + return ExchangeRateTuple.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): ExchangeRateTuple { + const message = createBaseExchangeRateTuple(); + message.pair = object.pair ?? ""; + message.exchangeRate = object.exchangeRate ?? ""; + return message; + }, +}; + +function createBaseDatedPrice(): DatedPrice { + return { exchangeRate: "", createdBlock: Long.UZERO }; +} + +export const DatedPrice = { + encode(message: DatedPrice, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.exchangeRate !== "") { + writer.uint32(10).string(message.exchangeRate); + } + if (!message.createdBlock.isZero()) { + writer.uint32(16).uint64(message.createdBlock); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DatedPrice { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDatedPrice(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.exchangeRate = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.createdBlock = reader.uint64() as Long; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DatedPrice { + return { + exchangeRate: isSet(object.exchangeRate) ? String(object.exchangeRate) : "", + createdBlock: isSet(object.createdBlock) ? Long.fromValue(object.createdBlock) : Long.UZERO, + }; + }, + + toJSON(message: DatedPrice): unknown { + const obj: any = {}; + message.exchangeRate !== undefined && (obj.exchangeRate = message.exchangeRate); + message.createdBlock !== undefined && (obj.createdBlock = (message.createdBlock || Long.UZERO).toString()); + return obj; + }, + + create, I>>(base?: I): DatedPrice { + return DatedPrice.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): DatedPrice { + const message = createBaseDatedPrice(); + message.exchangeRate = object.exchangeRate ?? ""; + message.createdBlock = (object.createdBlock !== undefined && object.createdBlock !== null) + ? Long.fromValue(object.createdBlock) + : Long.UZERO; + return message; + }, +}; + +function createBaseRewards(): Rewards { + return { id: Long.UZERO, votePeriods: Long.UZERO, coins: [] }; +} + +export const Rewards = { + encode(message: Rewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (!message.id.isZero()) { + writer.uint32(8).uint64(message.id); + } + if (!message.votePeriods.isZero()) { + writer.uint32(16).uint64(message.votePeriods); + } + for (const v of message.coins) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Rewards { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRewards(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.id = reader.uint64() as Long; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.votePeriods = reader.uint64() as Long; + continue; + case 3: + if (tag !== 26) { + break; + } + + message.coins.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Rewards { + return { + id: isSet(object.id) ? Long.fromValue(object.id) : Long.UZERO, + votePeriods: isSet(object.votePeriods) ? Long.fromValue(object.votePeriods) : Long.UZERO, + coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: Rewards): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = (message.id || Long.UZERO).toString()); + message.votePeriods !== undefined && (obj.votePeriods = (message.votePeriods || Long.UZERO).toString()); + if (message.coins) { + obj.coins = message.coins.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.coins = []; + } + return obj; + }, + + create, I>>(base?: I): Rewards { + return Rewards.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): Rewards { + const message = createBaseRewards(); + message.id = (object.id !== undefined && object.id !== null) ? Long.fromValue(object.id) : Long.UZERO; + message.votePeriods = (object.votePeriods !== undefined && object.votePeriods !== null) + ? Long.fromValue(object.votePeriods) + : Long.UZERO; + message.coins = object.coins?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/nibiru/oracle/v1/query.ts b/src/protojs/nibiru/oracle/v1/query.ts new file mode 100644 index 00000000..dca82d60 --- /dev/null +++ b/src/protojs/nibiru/oracle/v1/query.ts @@ -0,0 +1,1562 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { AggregateExchangeRatePrevote, AggregateExchangeRateVote, ExchangeRateTuple, Params } from "./oracle"; + +/** + * QueryExchangeRateRequest is the request type for the Query/ExchangeRate RPC + * method. + */ +export interface QueryExchangeRateRequest { + /** pair defines the pair to query for. */ + pair: string; +} + +/** + * QueryExchangeRateResponse is response type for the + * Query/ExchangeRate RPC method. + */ +export interface QueryExchangeRateResponse { + /** exchange_rate defines the exchange rate of assets voted by validators */ + exchangeRate: string; +} + +/** + * QueryExchangeRatesRequest is the request type for the Query/ExchangeRates RPC + * method. + */ +export interface QueryExchangeRatesRequest { +} + +/** + * QueryExchangeRatesResponse is response type for the + * Query/ExchangeRates RPC method. + */ +export interface QueryExchangeRatesResponse { + /** + * exchange_rates defines a list of the exchange rate for all whitelisted + * pairs. + */ + exchangeRates: ExchangeRateTuple[]; +} + +/** QueryActivesRequest is the request type for the Query/Actives RPC method. */ +export interface QueryActivesRequest { +} + +/** + * QueryActivesResponse is response type for the + * Query/Actives RPC method. + */ +export interface QueryActivesResponse { + /** actives defines a list of the pair which oracle prices agreed upon. */ + actives: string[]; +} + +/** + * QueryVoteTargetsRequest is the request type for the Query/VoteTargets RPC + * method. + */ +export interface QueryVoteTargetsRequest { +} + +/** + * QueryVoteTargetsResponse is response type for the + * Query/VoteTargets RPC method. + */ +export interface QueryVoteTargetsResponse { + /** + * vote_targets defines a list of the pairs in which everyone + * should vote in the current vote period. + */ + voteTargets: string[]; +} + +/** + * QueryFeederDelegationRequest is the request type for the + * Query/FeederDelegation RPC method. + */ +export interface QueryFeederDelegationRequest { + /** validator defines the validator address to query for. */ + validatorAddr: string; +} + +/** + * QueryFeederDelegationResponse is response type for the + * Query/FeederDelegation RPC method. + */ +export interface QueryFeederDelegationResponse { + /** feeder_addr defines the feeder delegation of a validator */ + feederAddr: string; +} + +/** + * QueryMissCounterRequest is the request type for the Query/MissCounter RPC + * method. + */ +export interface QueryMissCounterRequest { + /** validator defines the validator address to query for. */ + validatorAddr: string; +} + +/** + * QueryMissCounterResponse is response type for the + * Query/MissCounter RPC method. + */ +export interface QueryMissCounterResponse { + /** miss_counter defines the oracle miss counter of a validator */ + missCounter: Long; +} + +/** + * QueryAggregatePrevoteRequest is the request type for the + * Query/AggregatePrevote RPC method. + */ +export interface QueryAggregatePrevoteRequest { + /** validator defines the validator address to query for. */ + validatorAddr: string; +} + +/** + * QueryAggregatePrevoteResponse is response type for the + * Query/AggregatePrevote RPC method. + */ +export interface QueryAggregatePrevoteResponse { + /** + * aggregate_prevote defines oracle aggregate prevote submitted by a validator + * in the current vote period + */ + aggregatePrevote?: AggregateExchangeRatePrevote; +} + +/** + * QueryAggregatePrevotesRequest is the request type for the + * Query/AggregatePrevotes RPC method. + */ +export interface QueryAggregatePrevotesRequest { +} + +/** + * QueryAggregatePrevotesResponse is response type for the + * Query/AggregatePrevotes RPC method. + */ +export interface QueryAggregatePrevotesResponse { + /** + * aggregate_prevotes defines all oracle aggregate prevotes submitted in the + * current vote period + */ + aggregatePrevotes: AggregateExchangeRatePrevote[]; +} + +/** + * QueryAggregateVoteRequest is the request type for the Query/AggregateVote RPC + * method. + */ +export interface QueryAggregateVoteRequest { + /** validator defines the validator address to query for. */ + validatorAddr: string; +} + +/** + * QueryAggregateVoteResponse is response type for the + * Query/AggregateVote RPC method. + */ +export interface QueryAggregateVoteResponse { + /** + * aggregate_vote defines oracle aggregate vote submitted by a validator in + * the current vote period + */ + aggregateVote?: AggregateExchangeRateVote; +} + +/** + * QueryAggregateVotesRequest is the request type for the Query/AggregateVotes + * RPC method. + */ +export interface QueryAggregateVotesRequest { +} + +/** + * QueryAggregateVotesResponse is response type for the + * Query/AggregateVotes RPC method. + */ +export interface QueryAggregateVotesResponse { + /** + * aggregate_votes defines all oracle aggregate votes submitted in the current + * vote period + */ + aggregateVotes: AggregateExchangeRateVote[]; +} + +/** 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; +} + +function createBaseQueryExchangeRateRequest(): QueryExchangeRateRequest { + return { pair: "" }; +} + +export const QueryExchangeRateRequest = { + encode(message: QueryExchangeRateRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pair !== "") { + writer.uint32(10).string(message.pair); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryExchangeRateRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryExchangeRateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pair = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryExchangeRateRequest { + return { pair: isSet(object.pair) ? String(object.pair) : "" }; + }, + + toJSON(message: QueryExchangeRateRequest): unknown { + const obj: any = {}; + message.pair !== undefined && (obj.pair = message.pair); + return obj; + }, + + create, I>>(base?: I): QueryExchangeRateRequest { + return QueryExchangeRateRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryExchangeRateRequest { + const message = createBaseQueryExchangeRateRequest(); + message.pair = object.pair ?? ""; + return message; + }, +}; + +function createBaseQueryExchangeRateResponse(): QueryExchangeRateResponse { + return { exchangeRate: "" }; +} + +export const QueryExchangeRateResponse = { + encode(message: QueryExchangeRateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.exchangeRate !== "") { + writer.uint32(10).string(message.exchangeRate); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryExchangeRateResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryExchangeRateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.exchangeRate = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryExchangeRateResponse { + return { exchangeRate: isSet(object.exchangeRate) ? String(object.exchangeRate) : "" }; + }, + + toJSON(message: QueryExchangeRateResponse): unknown { + const obj: any = {}; + message.exchangeRate !== undefined && (obj.exchangeRate = message.exchangeRate); + return obj; + }, + + create, I>>(base?: I): QueryExchangeRateResponse { + return QueryExchangeRateResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryExchangeRateResponse { + const message = createBaseQueryExchangeRateResponse(); + message.exchangeRate = object.exchangeRate ?? ""; + return message; + }, +}; + +function createBaseQueryExchangeRatesRequest(): QueryExchangeRatesRequest { + return {}; +} + +export const QueryExchangeRatesRequest = { + encode(_: QueryExchangeRatesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryExchangeRatesRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryExchangeRatesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryExchangeRatesRequest { + return {}; + }, + + toJSON(_: QueryExchangeRatesRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryExchangeRatesRequest { + return QueryExchangeRatesRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>(_: I): QueryExchangeRatesRequest { + const message = createBaseQueryExchangeRatesRequest(); + return message; + }, +}; + +function createBaseQueryExchangeRatesResponse(): QueryExchangeRatesResponse { + return { exchangeRates: [] }; +} + +export const QueryExchangeRatesResponse = { + encode(message: QueryExchangeRatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.exchangeRates) { + ExchangeRateTuple.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryExchangeRatesResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryExchangeRatesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.exchangeRates.push(ExchangeRateTuple.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryExchangeRatesResponse { + return { + exchangeRates: Array.isArray(object?.exchangeRates) + ? object.exchangeRates.map((e: any) => ExchangeRateTuple.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryExchangeRatesResponse): unknown { + const obj: any = {}; + if (message.exchangeRates) { + obj.exchangeRates = message.exchangeRates.map((e) => e ? ExchangeRateTuple.toJSON(e) : undefined); + } else { + obj.exchangeRates = []; + } + return obj; + }, + + create, I>>(base?: I): QueryExchangeRatesResponse { + return QueryExchangeRatesResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryExchangeRatesResponse { + const message = createBaseQueryExchangeRatesResponse(); + message.exchangeRates = object.exchangeRates?.map((e) => ExchangeRateTuple.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryActivesRequest(): QueryActivesRequest { + return {}; +} + +export const QueryActivesRequest = { + encode(_: QueryActivesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryActivesRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryActivesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryActivesRequest { + return {}; + }, + + toJSON(_: QueryActivesRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryActivesRequest { + return QueryActivesRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>(_: I): QueryActivesRequest { + const message = createBaseQueryActivesRequest(); + return message; + }, +}; + +function createBaseQueryActivesResponse(): QueryActivesResponse { + return { actives: [] }; +} + +export const QueryActivesResponse = { + encode(message: QueryActivesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.actives) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryActivesResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryActivesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.actives.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryActivesResponse { + return { actives: Array.isArray(object?.actives) ? object.actives.map((e: any) => String(e)) : [] }; + }, + + toJSON(message: QueryActivesResponse): unknown { + const obj: any = {}; + if (message.actives) { + obj.actives = message.actives.map((e) => e); + } else { + obj.actives = []; + } + return obj; + }, + + create, I>>(base?: I): QueryActivesResponse { + return QueryActivesResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryActivesResponse { + const message = createBaseQueryActivesResponse(); + message.actives = object.actives?.map((e) => e) || []; + return message; + }, +}; + +function createBaseQueryVoteTargetsRequest(): QueryVoteTargetsRequest { + return {}; +} + +export const QueryVoteTargetsRequest = { + encode(_: QueryVoteTargetsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryVoteTargetsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteTargetsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryVoteTargetsRequest { + return {}; + }, + + toJSON(_: QueryVoteTargetsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryVoteTargetsRequest { + return QueryVoteTargetsRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>(_: I): QueryVoteTargetsRequest { + const message = createBaseQueryVoteTargetsRequest(); + return message; + }, +}; + +function createBaseQueryVoteTargetsResponse(): QueryVoteTargetsResponse { + return { voteTargets: [] }; +} + +export const QueryVoteTargetsResponse = { + encode(message: QueryVoteTargetsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.voteTargets) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryVoteTargetsResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteTargetsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.voteTargets.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVoteTargetsResponse { + return { voteTargets: Array.isArray(object?.voteTargets) ? object.voteTargets.map((e: any) => String(e)) : [] }; + }, + + toJSON(message: QueryVoteTargetsResponse): unknown { + const obj: any = {}; + if (message.voteTargets) { + obj.voteTargets = message.voteTargets.map((e) => e); + } else { + obj.voteTargets = []; + } + return obj; + }, + + create, I>>(base?: I): QueryVoteTargetsResponse { + return QueryVoteTargetsResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryVoteTargetsResponse { + const message = createBaseQueryVoteTargetsResponse(); + message.voteTargets = object.voteTargets?.map((e) => e) || []; + return message; + }, +}; + +function createBaseQueryFeederDelegationRequest(): QueryFeederDelegationRequest { + return { validatorAddr: "" }; +} + +export const QueryFeederDelegationRequest = { + encode(message: QueryFeederDelegationRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddr !== "") { + writer.uint32(10).string(message.validatorAddr); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryFeederDelegationRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryFeederDelegationRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryFeederDelegationRequest { + return { validatorAddr: isSet(object.validatorAddr) ? String(object.validatorAddr) : "" }; + }, + + toJSON(message: QueryFeederDelegationRequest): unknown { + const obj: any = {}; + message.validatorAddr !== undefined && (obj.validatorAddr = message.validatorAddr); + return obj; + }, + + create, I>>(base?: I): QueryFeederDelegationRequest { + return QueryFeederDelegationRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryFeederDelegationRequest { + const message = createBaseQueryFeederDelegationRequest(); + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, +}; + +function createBaseQueryFeederDelegationResponse(): QueryFeederDelegationResponse { + return { feederAddr: "" }; +} + +export const QueryFeederDelegationResponse = { + encode(message: QueryFeederDelegationResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.feederAddr !== "") { + writer.uint32(10).string(message.feederAddr); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryFeederDelegationResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryFeederDelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.feederAddr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryFeederDelegationResponse { + return { feederAddr: isSet(object.feederAddr) ? String(object.feederAddr) : "" }; + }, + + toJSON(message: QueryFeederDelegationResponse): unknown { + const obj: any = {}; + message.feederAddr !== undefined && (obj.feederAddr = message.feederAddr); + return obj; + }, + + create, I>>(base?: I): QueryFeederDelegationResponse { + return QueryFeederDelegationResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>( + object: I, + ): QueryFeederDelegationResponse { + const message = createBaseQueryFeederDelegationResponse(); + message.feederAddr = object.feederAddr ?? ""; + return message; + }, +}; + +function createBaseQueryMissCounterRequest(): QueryMissCounterRequest { + return { validatorAddr: "" }; +} + +export const QueryMissCounterRequest = { + encode(message: QueryMissCounterRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddr !== "") { + writer.uint32(10).string(message.validatorAddr); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryMissCounterRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryMissCounterRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryMissCounterRequest { + return { validatorAddr: isSet(object.validatorAddr) ? String(object.validatorAddr) : "" }; + }, + + toJSON(message: QueryMissCounterRequest): unknown { + const obj: any = {}; + message.validatorAddr !== undefined && (obj.validatorAddr = message.validatorAddr); + return obj; + }, + + create, I>>(base?: I): QueryMissCounterRequest { + return QueryMissCounterRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryMissCounterRequest { + const message = createBaseQueryMissCounterRequest(); + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, +}; + +function createBaseQueryMissCounterResponse(): QueryMissCounterResponse { + return { missCounter: Long.UZERO }; +} + +export const QueryMissCounterResponse = { + encode(message: QueryMissCounterResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (!message.missCounter.isZero()) { + writer.uint32(8).uint64(message.missCounter); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryMissCounterResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryMissCounterResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.missCounter = reader.uint64() as Long; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryMissCounterResponse { + return { missCounter: isSet(object.missCounter) ? Long.fromValue(object.missCounter) : Long.UZERO }; + }, + + toJSON(message: QueryMissCounterResponse): unknown { + const obj: any = {}; + message.missCounter !== undefined && (obj.missCounter = (message.missCounter || Long.UZERO).toString()); + return obj; + }, + + create, I>>(base?: I): QueryMissCounterResponse { + return QueryMissCounterResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryMissCounterResponse { + const message = createBaseQueryMissCounterResponse(); + message.missCounter = (object.missCounter !== undefined && object.missCounter !== null) + ? Long.fromValue(object.missCounter) + : Long.UZERO; + return message; + }, +}; + +function createBaseQueryAggregatePrevoteRequest(): QueryAggregatePrevoteRequest { + return { validatorAddr: "" }; +} + +export const QueryAggregatePrevoteRequest = { + encode(message: QueryAggregatePrevoteRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddr !== "") { + writer.uint32(10).string(message.validatorAddr); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAggregatePrevoteRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAggregatePrevoteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAggregatePrevoteRequest { + return { validatorAddr: isSet(object.validatorAddr) ? String(object.validatorAddr) : "" }; + }, + + toJSON(message: QueryAggregatePrevoteRequest): unknown { + const obj: any = {}; + message.validatorAddr !== undefined && (obj.validatorAddr = message.validatorAddr); + return obj; + }, + + create, I>>(base?: I): QueryAggregatePrevoteRequest { + return QueryAggregatePrevoteRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryAggregatePrevoteRequest { + const message = createBaseQueryAggregatePrevoteRequest(); + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, +}; + +function createBaseQueryAggregatePrevoteResponse(): QueryAggregatePrevoteResponse { + return { aggregatePrevote: undefined }; +} + +export const QueryAggregatePrevoteResponse = { + encode(message: QueryAggregatePrevoteResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.aggregatePrevote !== undefined) { + AggregateExchangeRatePrevote.encode(message.aggregatePrevote, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAggregatePrevoteResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAggregatePrevoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.aggregatePrevote = AggregateExchangeRatePrevote.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAggregatePrevoteResponse { + return { + aggregatePrevote: isSet(object.aggregatePrevote) + ? AggregateExchangeRatePrevote.fromJSON(object.aggregatePrevote) + : undefined, + }; + }, + + toJSON(message: QueryAggregatePrevoteResponse): unknown { + const obj: any = {}; + message.aggregatePrevote !== undefined && (obj.aggregatePrevote = message.aggregatePrevote + ? AggregateExchangeRatePrevote.toJSON(message.aggregatePrevote) + : undefined); + return obj; + }, + + create, I>>(base?: I): QueryAggregatePrevoteResponse { + return QueryAggregatePrevoteResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>( + object: I, + ): QueryAggregatePrevoteResponse { + const message = createBaseQueryAggregatePrevoteResponse(); + message.aggregatePrevote = (object.aggregatePrevote !== undefined && object.aggregatePrevote !== null) + ? AggregateExchangeRatePrevote.fromPartial(object.aggregatePrevote) + : undefined; + return message; + }, +}; + +function createBaseQueryAggregatePrevotesRequest(): QueryAggregatePrevotesRequest { + return {}; +} + +export const QueryAggregatePrevotesRequest = { + encode(_: QueryAggregatePrevotesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAggregatePrevotesRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAggregatePrevotesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryAggregatePrevotesRequest { + return {}; + }, + + toJSON(_: QueryAggregatePrevotesRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryAggregatePrevotesRequest { + return QueryAggregatePrevotesRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>(_: I): QueryAggregatePrevotesRequest { + const message = createBaseQueryAggregatePrevotesRequest(); + return message; + }, +}; + +function createBaseQueryAggregatePrevotesResponse(): QueryAggregatePrevotesResponse { + return { aggregatePrevotes: [] }; +} + +export const QueryAggregatePrevotesResponse = { + encode(message: QueryAggregatePrevotesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.aggregatePrevotes) { + AggregateExchangeRatePrevote.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAggregatePrevotesResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAggregatePrevotesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.aggregatePrevotes.push(AggregateExchangeRatePrevote.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAggregatePrevotesResponse { + return { + aggregatePrevotes: Array.isArray(object?.aggregatePrevotes) + ? object.aggregatePrevotes.map((e: any) => AggregateExchangeRatePrevote.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryAggregatePrevotesResponse): unknown { + const obj: any = {}; + if (message.aggregatePrevotes) { + obj.aggregatePrevotes = message.aggregatePrevotes.map((e) => + e ? AggregateExchangeRatePrevote.toJSON(e) : undefined + ); + } else { + obj.aggregatePrevotes = []; + } + return obj; + }, + + create, I>>(base?: I): QueryAggregatePrevotesResponse { + return QueryAggregatePrevotesResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>( + object: I, + ): QueryAggregatePrevotesResponse { + const message = createBaseQueryAggregatePrevotesResponse(); + message.aggregatePrevotes = object.aggregatePrevotes?.map((e) => AggregateExchangeRatePrevote.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryAggregateVoteRequest(): QueryAggregateVoteRequest { + return { validatorAddr: "" }; +} + +export const QueryAggregateVoteRequest = { + encode(message: QueryAggregateVoteRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validatorAddr !== "") { + writer.uint32(10).string(message.validatorAddr); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAggregateVoteRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAggregateVoteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validatorAddr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAggregateVoteRequest { + return { validatorAddr: isSet(object.validatorAddr) ? String(object.validatorAddr) : "" }; + }, + + toJSON(message: QueryAggregateVoteRequest): unknown { + const obj: any = {}; + message.validatorAddr !== undefined && (obj.validatorAddr = message.validatorAddr); + return obj; + }, + + create, I>>(base?: I): QueryAggregateVoteRequest { + return QueryAggregateVoteRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryAggregateVoteRequest { + const message = createBaseQueryAggregateVoteRequest(); + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, +}; + +function createBaseQueryAggregateVoteResponse(): QueryAggregateVoteResponse { + return { aggregateVote: undefined }; +} + +export const QueryAggregateVoteResponse = { + encode(message: QueryAggregateVoteResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.aggregateVote !== undefined) { + AggregateExchangeRateVote.encode(message.aggregateVote, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAggregateVoteResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAggregateVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.aggregateVote = AggregateExchangeRateVote.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAggregateVoteResponse { + return { + aggregateVote: isSet(object.aggregateVote) ? AggregateExchangeRateVote.fromJSON(object.aggregateVote) : undefined, + }; + }, + + toJSON(message: QueryAggregateVoteResponse): unknown { + const obj: any = {}; + message.aggregateVote !== undefined && + (obj.aggregateVote = message.aggregateVote ? AggregateExchangeRateVote.toJSON(message.aggregateVote) : undefined); + return obj; + }, + + create, I>>(base?: I): QueryAggregateVoteResponse { + return QueryAggregateVoteResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryAggregateVoteResponse { + const message = createBaseQueryAggregateVoteResponse(); + message.aggregateVote = (object.aggregateVote !== undefined && object.aggregateVote !== null) + ? AggregateExchangeRateVote.fromPartial(object.aggregateVote) + : undefined; + return message; + }, +}; + +function createBaseQueryAggregateVotesRequest(): QueryAggregateVotesRequest { + return {}; +} + +export const QueryAggregateVotesRequest = { + encode(_: QueryAggregateVotesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAggregateVotesRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAggregateVotesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryAggregateVotesRequest { + return {}; + }, + + toJSON(_: QueryAggregateVotesRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryAggregateVotesRequest { + return QueryAggregateVotesRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>(_: I): QueryAggregateVotesRequest { + const message = createBaseQueryAggregateVotesRequest(); + return message; + }, +}; + +function createBaseQueryAggregateVotesResponse(): QueryAggregateVotesResponse { + return { aggregateVotes: [] }; +} + +export const QueryAggregateVotesResponse = { + encode(message: QueryAggregateVotesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.aggregateVotes) { + AggregateExchangeRateVote.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAggregateVotesResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAggregateVotesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.aggregateVotes.push(AggregateExchangeRateVote.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAggregateVotesResponse { + return { + aggregateVotes: Array.isArray(object?.aggregateVotes) + ? object.aggregateVotes.map((e: any) => AggregateExchangeRateVote.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryAggregateVotesResponse): unknown { + const obj: any = {}; + if (message.aggregateVotes) { + obj.aggregateVotes = message.aggregateVotes.map((e) => e ? AggregateExchangeRateVote.toJSON(e) : undefined); + } else { + obj.aggregateVotes = []; + } + return obj; + }, + + create, I>>(base?: I): QueryAggregateVotesResponse { + return QueryAggregateVotesResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryAggregateVotesResponse { + const message = createBaseQueryAggregateVotesResponse(); + message.aggregateVotes = object.aggregateVotes?.map((e) => AggregateExchangeRateVote.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest = { + encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse = { + encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** ExchangeRate returns exchange rate of a pair */ + ExchangeRate(request: QueryExchangeRateRequest): Promise; + /** ExchangeRateTwap returns twap exchange rate of a pair */ + ExchangeRateTwap(request: QueryExchangeRateRequest): Promise; + /** ExchangeRates returns exchange rates of all pairs */ + ExchangeRates(request: QueryExchangeRatesRequest): Promise; + /** Actives returns all active pairs */ + Actives(request: QueryActivesRequest): Promise; + /** VoteTargets returns all vote target for pairs */ + VoteTargets(request: QueryVoteTargetsRequest): Promise; + /** FeederDelegation returns feeder delegation of a validator */ + FeederDelegation(request: QueryFeederDelegationRequest): Promise; + /** MissCounter returns oracle miss counter of a validator */ + MissCounter(request: QueryMissCounterRequest): Promise; + /** AggregatePrevote returns an aggregate prevote of a validator */ + AggregatePrevote(request: QueryAggregatePrevoteRequest): Promise; + /** AggregatePrevotes returns aggregate prevotes of all validators */ + AggregatePrevotes(request: QueryAggregatePrevotesRequest): Promise; + /** AggregateVote returns an aggregate vote of a validator */ + AggregateVote(request: QueryAggregateVoteRequest): Promise; + /** AggregateVotes returns aggregate votes of all validators */ + AggregateVotes(request: QueryAggregateVotesRequest): Promise; + /** Params queries all parameters. */ + Params(request: QueryParamsRequest): Promise; +} + +export const QueryServiceName = "nibiru.oracle.v1.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.ExchangeRate = this.ExchangeRate.bind(this); + this.ExchangeRateTwap = this.ExchangeRateTwap.bind(this); + this.ExchangeRates = this.ExchangeRates.bind(this); + this.Actives = this.Actives.bind(this); + this.VoteTargets = this.VoteTargets.bind(this); + this.FeederDelegation = this.FeederDelegation.bind(this); + this.MissCounter = this.MissCounter.bind(this); + this.AggregatePrevote = this.AggregatePrevote.bind(this); + this.AggregatePrevotes = this.AggregatePrevotes.bind(this); + this.AggregateVote = this.AggregateVote.bind(this); + this.AggregateVotes = this.AggregateVotes.bind(this); + this.Params = this.Params.bind(this); + } + ExchangeRate(request: QueryExchangeRateRequest): Promise { + const data = QueryExchangeRateRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ExchangeRate", data); + return promise.then((data) => QueryExchangeRateResponse.decode(_m0.Reader.create(data))); + } + + ExchangeRateTwap(request: QueryExchangeRateRequest): Promise { + const data = QueryExchangeRateRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ExchangeRateTwap", data); + return promise.then((data) => QueryExchangeRateResponse.decode(_m0.Reader.create(data))); + } + + ExchangeRates(request: QueryExchangeRatesRequest): Promise { + const data = QueryExchangeRatesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ExchangeRates", data); + return promise.then((data) => QueryExchangeRatesResponse.decode(_m0.Reader.create(data))); + } + + Actives(request: QueryActivesRequest): Promise { + const data = QueryActivesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Actives", data); + return promise.then((data) => QueryActivesResponse.decode(_m0.Reader.create(data))); + } + + VoteTargets(request: QueryVoteTargetsRequest): Promise { + const data = QueryVoteTargetsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "VoteTargets", data); + return promise.then((data) => QueryVoteTargetsResponse.decode(_m0.Reader.create(data))); + } + + FeederDelegation(request: QueryFeederDelegationRequest): Promise { + const data = QueryFeederDelegationRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "FeederDelegation", data); + return promise.then((data) => QueryFeederDelegationResponse.decode(_m0.Reader.create(data))); + } + + MissCounter(request: QueryMissCounterRequest): Promise { + const data = QueryMissCounterRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "MissCounter", data); + return promise.then((data) => QueryMissCounterResponse.decode(_m0.Reader.create(data))); + } + + AggregatePrevote(request: QueryAggregatePrevoteRequest): Promise { + const data = QueryAggregatePrevoteRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AggregatePrevote", data); + return promise.then((data) => QueryAggregatePrevoteResponse.decode(_m0.Reader.create(data))); + } + + AggregatePrevotes(request: QueryAggregatePrevotesRequest): Promise { + const data = QueryAggregatePrevotesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AggregatePrevotes", data); + return promise.then((data) => QueryAggregatePrevotesResponse.decode(_m0.Reader.create(data))); + } + + AggregateVote(request: QueryAggregateVoteRequest): Promise { + const data = QueryAggregateVoteRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AggregateVote", data); + return promise.then((data) => QueryAggregateVoteResponse.decode(_m0.Reader.create(data))); + } + + AggregateVotes(request: QueryAggregateVotesRequest): Promise { + const data = QueryAggregateVotesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AggregateVotes", data); + return promise.then((data) => QueryAggregateVotesResponse.decode(_m0.Reader.create(data))); + } + + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => QueryParamsResponse.decode(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/nibiru/oracle/v1/state.ts b/src/protojs/nibiru/oracle/v1/state.ts new file mode 100644 index 00000000..f6ead1af --- /dev/null +++ b/src/protojs/nibiru/oracle/v1/state.ts @@ -0,0 +1,118 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +/** a snapshot of the prices at a given point in time */ +export interface PriceSnapshot { + pair: string; + price: string; + /** milliseconds since unix epoch */ + timestampMs: Long; +} + +function createBasePriceSnapshot(): PriceSnapshot { + return { pair: "", price: "", timestampMs: Long.ZERO }; +} + +export const PriceSnapshot = { + encode(message: PriceSnapshot, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pair !== "") { + writer.uint32(10).string(message.pair); + } + if (message.price !== "") { + writer.uint32(18).string(message.price); + } + if (!message.timestampMs.isZero()) { + writer.uint32(24).int64(message.timestampMs); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PriceSnapshot { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePriceSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pair = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.price = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.timestampMs = reader.int64() as Long; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): PriceSnapshot { + return { + pair: isSet(object.pair) ? String(object.pair) : "", + price: isSet(object.price) ? String(object.price) : "", + timestampMs: isSet(object.timestampMs) ? Long.fromValue(object.timestampMs) : Long.ZERO, + }; + }, + + toJSON(message: PriceSnapshot): unknown { + const obj: any = {}; + message.pair !== undefined && (obj.pair = message.pair); + message.price !== undefined && (obj.price = message.price); + message.timestampMs !== undefined && (obj.timestampMs = (message.timestampMs || Long.ZERO).toString()); + return obj; + }, + + create, I>>(base?: I): PriceSnapshot { + return PriceSnapshot.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): PriceSnapshot { + const message = createBasePriceSnapshot(); + message.pair = object.pair ?? ""; + message.price = object.price ?? ""; + message.timestampMs = (object.timestampMs !== undefined && object.timestampMs !== null) + ? Long.fromValue(object.timestampMs) + : Long.ZERO; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/nibiru/oracle/v1/tx.ts b/src/protojs/nibiru/oracle/v1/tx.ts new file mode 100644 index 00000000..dbe6fae5 --- /dev/null +++ b/src/protojs/nibiru/oracle/v1/tx.ts @@ -0,0 +1,842 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Params } from "./oracle"; + +/** + * MsgAggregateExchangeRatePrevote represents a message to submit + * aggregate exchange rate prevote. + */ +export interface MsgAggregateExchangeRatePrevote { + hash: string; + /** + * Feeder is the Bech32 address of the price feeder. A validator may + * specify multiple price feeders by delegating them consent. The validator + * address is also a valid feeder by default. + */ + feeder: string; + /** Validator is the Bech32 address to which the prevote will be credited. */ + validator: string; +} + +/** + * MsgAggregateExchangeRatePrevoteResponse defines the + * Msg/AggregateExchangeRatePrevote response type. + */ +export interface MsgAggregateExchangeRatePrevoteResponse { +} + +/** + * MsgAggregateExchangeRateVote represents a message to submit + * aggregate exchange rate vote. + */ +export interface MsgAggregateExchangeRateVote { + salt: string; + exchangeRates: string; + /** + * Feeder is the Bech32 address of the price feeder. A validator may + * specify multiple price feeders by delegating them consent. The validator + * address is also a valid feeder by default. + */ + feeder: string; + /** Validator is the Bech32 address to which the vote will be credited. */ + validator: string; +} + +/** + * MsgAggregateExchangeRateVoteResponse defines the + * Msg/AggregateExchangeRateVote response type. + */ +export interface MsgAggregateExchangeRateVoteResponse { +} + +/** + * MsgDelegateFeedConsent represents a message to delegate oracle voting rights + * to another address. + */ +export interface MsgDelegateFeedConsent { + operator: string; + delegate: string; +} + +/** + * MsgDelegateFeedConsentResponse defines the Msg/DelegateFeedConsent response + * type. + */ +export interface MsgDelegateFeedConsentResponse { +} + +/** + * MsgEditOracleParams: gRPC tx message for updating the x/oracle module params + * [SUDO] Only callable by sudoers. + */ +export interface MsgEditOracleParams { + sender: string; + votePeriod: string; + /** vote_threshold: [cosmossdk.io/math.LegacyDec] TODO: */ + voteThreshold: string; + /** reward_band: [cosmossdk.io/math.LegacyDec] TODO: */ + rewardBand: string; + whitelist: string[]; + /** slash_fraction: [cosmossdk.io/math.LegacyDec] TODO: */ + slashFraction: string; + slashWindow: string; + /** min_valid_per_window: [cosmossdk.io/math.LegacyDec] TODO: */ + minValidPerWindow: string; + twapLookbackWindow: string; + minVoters: string; + /** VoteThreshold: [cosmossdk.io/math.LegacyDec] TODO: */ + validatorFeeRatio: string; +} + +/** + * MsgEditOracleParamsResponse defines the Msg/EditOracleParams response + * type. + */ +export interface MsgEditOracleParamsResponse { + newParams?: Params; +} + +function createBaseMsgAggregateExchangeRatePrevote(): MsgAggregateExchangeRatePrevote { + return { hash: "", feeder: "", validator: "" }; +} + +export const MsgAggregateExchangeRatePrevote = { + encode(message: MsgAggregateExchangeRatePrevote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.hash !== "") { + writer.uint32(10).string(message.hash); + } + if (message.feeder !== "") { + writer.uint32(18).string(message.feeder); + } + if (message.validator !== "") { + writer.uint32(26).string(message.validator); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgAggregateExchangeRatePrevote { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAggregateExchangeRatePrevote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.hash = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.feeder = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgAggregateExchangeRatePrevote { + return { + hash: isSet(object.hash) ? String(object.hash) : "", + feeder: isSet(object.feeder) ? String(object.feeder) : "", + validator: isSet(object.validator) ? String(object.validator) : "", + }; + }, + + toJSON(message: MsgAggregateExchangeRatePrevote): unknown { + const obj: any = {}; + message.hash !== undefined && (obj.hash = message.hash); + message.feeder !== undefined && (obj.feeder = message.feeder); + message.validator !== undefined && (obj.validator = message.validator); + return obj; + }, + + create, I>>(base?: I): MsgAggregateExchangeRatePrevote { + return MsgAggregateExchangeRatePrevote.fromPartial(base ?? {}); + }, + + fromPartial, I>>( + object: I, + ): MsgAggregateExchangeRatePrevote { + const message = createBaseMsgAggregateExchangeRatePrevote(); + message.hash = object.hash ?? ""; + message.feeder = object.feeder ?? ""; + message.validator = object.validator ?? ""; + return message; + }, +}; + +function createBaseMsgAggregateExchangeRatePrevoteResponse(): MsgAggregateExchangeRatePrevoteResponse { + return {}; +} + +export const MsgAggregateExchangeRatePrevoteResponse = { + encode(_: MsgAggregateExchangeRatePrevoteResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgAggregateExchangeRatePrevoteResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAggregateExchangeRatePrevoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgAggregateExchangeRatePrevoteResponse { + return {}; + }, + + toJSON(_: MsgAggregateExchangeRatePrevoteResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgAggregateExchangeRatePrevoteResponse { + return MsgAggregateExchangeRatePrevoteResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>( + _: I, + ): MsgAggregateExchangeRatePrevoteResponse { + const message = createBaseMsgAggregateExchangeRatePrevoteResponse(); + return message; + }, +}; + +function createBaseMsgAggregateExchangeRateVote(): MsgAggregateExchangeRateVote { + return { salt: "", exchangeRates: "", feeder: "", validator: "" }; +} + +export const MsgAggregateExchangeRateVote = { + encode(message: MsgAggregateExchangeRateVote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.salt !== "") { + writer.uint32(10).string(message.salt); + } + if (message.exchangeRates !== "") { + writer.uint32(18).string(message.exchangeRates); + } + if (message.feeder !== "") { + writer.uint32(26).string(message.feeder); + } + if (message.validator !== "") { + writer.uint32(34).string(message.validator); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgAggregateExchangeRateVote { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAggregateExchangeRateVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.salt = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.exchangeRates = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.feeder = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgAggregateExchangeRateVote { + return { + salt: isSet(object.salt) ? String(object.salt) : "", + exchangeRates: isSet(object.exchangeRates) ? String(object.exchangeRates) : "", + feeder: isSet(object.feeder) ? String(object.feeder) : "", + validator: isSet(object.validator) ? String(object.validator) : "", + }; + }, + + toJSON(message: MsgAggregateExchangeRateVote): unknown { + const obj: any = {}; + message.salt !== undefined && (obj.salt = message.salt); + message.exchangeRates !== undefined && (obj.exchangeRates = message.exchangeRates); + message.feeder !== undefined && (obj.feeder = message.feeder); + message.validator !== undefined && (obj.validator = message.validator); + return obj; + }, + + create, I>>(base?: I): MsgAggregateExchangeRateVote { + return MsgAggregateExchangeRateVote.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): MsgAggregateExchangeRateVote { + const message = createBaseMsgAggregateExchangeRateVote(); + message.salt = object.salt ?? ""; + message.exchangeRates = object.exchangeRates ?? ""; + message.feeder = object.feeder ?? ""; + message.validator = object.validator ?? ""; + return message; + }, +}; + +function createBaseMsgAggregateExchangeRateVoteResponse(): MsgAggregateExchangeRateVoteResponse { + return {}; +} + +export const MsgAggregateExchangeRateVoteResponse = { + encode(_: MsgAggregateExchangeRateVoteResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgAggregateExchangeRateVoteResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAggregateExchangeRateVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgAggregateExchangeRateVoteResponse { + return {}; + }, + + toJSON(_: MsgAggregateExchangeRateVoteResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): MsgAggregateExchangeRateVoteResponse { + return MsgAggregateExchangeRateVoteResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>( + _: I, + ): MsgAggregateExchangeRateVoteResponse { + const message = createBaseMsgAggregateExchangeRateVoteResponse(); + return message; + }, +}; + +function createBaseMsgDelegateFeedConsent(): MsgDelegateFeedConsent { + return { operator: "", delegate: "" }; +} + +export const MsgDelegateFeedConsent = { + encode(message: MsgDelegateFeedConsent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.operator !== "") { + writer.uint32(10).string(message.operator); + } + if (message.delegate !== "") { + writer.uint32(18).string(message.delegate); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDelegateFeedConsent { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDelegateFeedConsent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.delegate = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDelegateFeedConsent { + return { + operator: isSet(object.operator) ? String(object.operator) : "", + delegate: isSet(object.delegate) ? String(object.delegate) : "", + }; + }, + + toJSON(message: MsgDelegateFeedConsent): unknown { + const obj: any = {}; + message.operator !== undefined && (obj.operator = message.operator); + message.delegate !== undefined && (obj.delegate = message.delegate); + return obj; + }, + + create, I>>(base?: I): MsgDelegateFeedConsent { + return MsgDelegateFeedConsent.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): MsgDelegateFeedConsent { + const message = createBaseMsgDelegateFeedConsent(); + message.operator = object.operator ?? ""; + message.delegate = object.delegate ?? ""; + return message; + }, +}; + +function createBaseMsgDelegateFeedConsentResponse(): MsgDelegateFeedConsentResponse { + return {}; +} + +export const MsgDelegateFeedConsentResponse = { + encode(_: MsgDelegateFeedConsentResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDelegateFeedConsentResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDelegateFeedConsentResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDelegateFeedConsentResponse { + return {}; + }, + + toJSON(_: MsgDelegateFeedConsentResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgDelegateFeedConsentResponse { + return MsgDelegateFeedConsentResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(_: I): MsgDelegateFeedConsentResponse { + const message = createBaseMsgDelegateFeedConsentResponse(); + return message; + }, +}; + +function createBaseMsgEditOracleParams(): MsgEditOracleParams { + return { + sender: "", + votePeriod: "", + voteThreshold: "", + rewardBand: "", + whitelist: [], + slashFraction: "", + slashWindow: "", + minValidPerWindow: "", + twapLookbackWindow: "", + minVoters: "", + validatorFeeRatio: "", + }; +} + +export const MsgEditOracleParams = { + encode(message: MsgEditOracleParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.votePeriod !== "") { + writer.uint32(18).string(message.votePeriod); + } + if (message.voteThreshold !== "") { + writer.uint32(26).string(message.voteThreshold); + } + if (message.rewardBand !== "") { + writer.uint32(34).string(message.rewardBand); + } + for (const v of message.whitelist) { + writer.uint32(42).string(v!); + } + if (message.slashFraction !== "") { + writer.uint32(50).string(message.slashFraction); + } + if (message.slashWindow !== "") { + writer.uint32(58).string(message.slashWindow); + } + if (message.minValidPerWindow !== "") { + writer.uint32(66).string(message.minValidPerWindow); + } + if (message.twapLookbackWindow !== "") { + writer.uint32(74).string(message.twapLookbackWindow); + } + if (message.minVoters !== "") { + writer.uint32(82).string(message.minVoters); + } + if (message.validatorFeeRatio !== "") { + writer.uint32(90).string(message.validatorFeeRatio); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgEditOracleParams { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgEditOracleParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sender = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.votePeriod = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.voteThreshold = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.rewardBand = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.whitelist.push(reader.string()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.slashFraction = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.slashWindow = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.minValidPerWindow = reader.string(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.twapLookbackWindow = reader.string(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.minVoters = reader.string(); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.validatorFeeRatio = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgEditOracleParams { + return { + sender: isSet(object.sender) ? String(object.sender) : "", + votePeriod: isSet(object.votePeriod) ? String(object.votePeriod) : "", + voteThreshold: isSet(object.voteThreshold) ? String(object.voteThreshold) : "", + rewardBand: isSet(object.rewardBand) ? String(object.rewardBand) : "", + whitelist: Array.isArray(object?.whitelist) ? object.whitelist.map((e: any) => String(e)) : [], + slashFraction: isSet(object.slashFraction) ? String(object.slashFraction) : "", + slashWindow: isSet(object.slashWindow) ? String(object.slashWindow) : "", + minValidPerWindow: isSet(object.minValidPerWindow) ? String(object.minValidPerWindow) : "", + twapLookbackWindow: isSet(object.twapLookbackWindow) ? String(object.twapLookbackWindow) : "", + minVoters: isSet(object.minVoters) ? String(object.minVoters) : "", + validatorFeeRatio: isSet(object.validatorFeeRatio) ? String(object.validatorFeeRatio) : "", + }; + }, + + toJSON(message: MsgEditOracleParams): unknown { + const obj: any = {}; + message.sender !== undefined && (obj.sender = message.sender); + message.votePeriod !== undefined && (obj.votePeriod = message.votePeriod); + message.voteThreshold !== undefined && (obj.voteThreshold = message.voteThreshold); + message.rewardBand !== undefined && (obj.rewardBand = message.rewardBand); + if (message.whitelist) { + obj.whitelist = message.whitelist.map((e) => e); + } else { + obj.whitelist = []; + } + message.slashFraction !== undefined && (obj.slashFraction = message.slashFraction); + message.slashWindow !== undefined && (obj.slashWindow = message.slashWindow); + message.minValidPerWindow !== undefined && (obj.minValidPerWindow = message.minValidPerWindow); + message.twapLookbackWindow !== undefined && (obj.twapLookbackWindow = message.twapLookbackWindow); + message.minVoters !== undefined && (obj.minVoters = message.minVoters); + message.validatorFeeRatio !== undefined && (obj.validatorFeeRatio = message.validatorFeeRatio); + return obj; + }, + + create, I>>(base?: I): MsgEditOracleParams { + return MsgEditOracleParams.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): MsgEditOracleParams { + const message = createBaseMsgEditOracleParams(); + message.sender = object.sender ?? ""; + message.votePeriod = object.votePeriod ?? ""; + message.voteThreshold = object.voteThreshold ?? ""; + message.rewardBand = object.rewardBand ?? ""; + message.whitelist = object.whitelist?.map((e) => e) || []; + message.slashFraction = object.slashFraction ?? ""; + message.slashWindow = object.slashWindow ?? ""; + message.minValidPerWindow = object.minValidPerWindow ?? ""; + message.twapLookbackWindow = object.twapLookbackWindow ?? ""; + message.minVoters = object.minVoters ?? ""; + message.validatorFeeRatio = object.validatorFeeRatio ?? ""; + return message; + }, +}; + +function createBaseMsgEditOracleParamsResponse(): MsgEditOracleParamsResponse { + return { newParams: undefined }; +} + +export const MsgEditOracleParamsResponse = { + encode(message: MsgEditOracleParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.newParams !== undefined) { + Params.encode(message.newParams, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgEditOracleParamsResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgEditOracleParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.newParams = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgEditOracleParamsResponse { + return { newParams: isSet(object.newParams) ? Params.fromJSON(object.newParams) : undefined }; + }, + + toJSON(message: MsgEditOracleParamsResponse): unknown { + const obj: any = {}; + message.newParams !== undefined && + (obj.newParams = message.newParams ? Params.toJSON(message.newParams) : undefined); + return obj; + }, + + create, I>>(base?: I): MsgEditOracleParamsResponse { + return MsgEditOracleParamsResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): MsgEditOracleParamsResponse { + const message = createBaseMsgEditOracleParamsResponse(); + message.newParams = (object.newParams !== undefined && object.newParams !== null) + ? Params.fromPartial(object.newParams) + : undefined; + return message; + }, +}; + +/** Msg defines the oracle Msg service. */ +export interface Msg { + /** + * AggregateExchangeRatePrevote defines a method for submitting + * aggregate exchange rate prevote + */ + AggregateExchangeRatePrevote( + request: MsgAggregateExchangeRatePrevote, + ): Promise; + /** + * AggregateExchangeRateVote defines a method for submitting + * aggregate exchange rate vote + */ + AggregateExchangeRateVote(request: MsgAggregateExchangeRateVote): Promise; + /** + * DelegateFeedConsent defines a method for delegating oracle voting rights + * to another address known as a price feeder. + * See https://github.com/NibiruChain/pricefeeder. + */ + DelegateFeedConsent(request: MsgDelegateFeedConsent): Promise; + EditOracleParams(request: MsgEditOracleParams): Promise; +} + +export const MsgServiceName = "nibiru.oracle.v1.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.AggregateExchangeRatePrevote = this.AggregateExchangeRatePrevote.bind(this); + this.AggregateExchangeRateVote = this.AggregateExchangeRateVote.bind(this); + this.DelegateFeedConsent = this.DelegateFeedConsent.bind(this); + this.EditOracleParams = this.EditOracleParams.bind(this); + } + AggregateExchangeRatePrevote( + request: MsgAggregateExchangeRatePrevote, + ): Promise { + const data = MsgAggregateExchangeRatePrevote.encode(request).finish(); + const promise = this.rpc.request(this.service, "AggregateExchangeRatePrevote", data); + return promise.then((data) => MsgAggregateExchangeRatePrevoteResponse.decode(_m0.Reader.create(data))); + } + + AggregateExchangeRateVote(request: MsgAggregateExchangeRateVote): Promise { + const data = MsgAggregateExchangeRateVote.encode(request).finish(); + const promise = this.rpc.request(this.service, "AggregateExchangeRateVote", data); + return promise.then((data) => MsgAggregateExchangeRateVoteResponse.decode(_m0.Reader.create(data))); + } + + DelegateFeedConsent(request: MsgDelegateFeedConsent): Promise { + const data = MsgDelegateFeedConsent.encode(request).finish(); + const promise = this.rpc.request(this.service, "DelegateFeedConsent", data); + return promise.then((data) => MsgDelegateFeedConsentResponse.decode(_m0.Reader.create(data))); + } + + EditOracleParams(request: MsgEditOracleParams): Promise { + const data = MsgEditOracleParams.encode(request).finish(); + const promise = this.rpc.request(this.service, "EditOracleParams", data); + return promise.then((data) => MsgEditOracleParamsResponse.decode(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/nibiru/sudo/v1/event.ts b/src/protojs/nibiru/sudo/v1/event.ts new file mode 100644 index 00000000..aacd1540 --- /dev/null +++ b/src/protojs/nibiru/sudo/v1/event.ts @@ -0,0 +1,105 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Sudoers } from "./state"; + +/** EventUpdateSudoers: ABCI event emitted upon execution of "MsgEditSudoers". */ +export interface EventUpdateSudoers { + sudoers?: Sudoers; + /** Action is the type of update that occured to the "sudoers" */ + action: string; +} + +function createBaseEventUpdateSudoers(): EventUpdateSudoers { + return { sudoers: undefined, action: "" }; +} + +export const EventUpdateSudoers = { + encode(message: EventUpdateSudoers, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.sudoers !== undefined) { + Sudoers.encode(message.sudoers, writer.uint32(10).fork()).ldelim(); + } + if (message.action !== "") { + writer.uint32(18).string(message.action); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventUpdateSudoers { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventUpdateSudoers(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sudoers = Sudoers.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.action = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventUpdateSudoers { + return { + sudoers: isSet(object.sudoers) ? Sudoers.fromJSON(object.sudoers) : undefined, + action: isSet(object.action) ? String(object.action) : "", + }; + }, + + toJSON(message: EventUpdateSudoers): unknown { + const obj: any = {}; + message.sudoers !== undefined && (obj.sudoers = message.sudoers ? Sudoers.toJSON(message.sudoers) : undefined); + message.action !== undefined && (obj.action = message.action); + return obj; + }, + + create, I>>(base?: I): EventUpdateSudoers { + return EventUpdateSudoers.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): EventUpdateSudoers { + const message = createBaseEventUpdateSudoers(); + message.sudoers = (object.sudoers !== undefined && object.sudoers !== null) + ? Sudoers.fromPartial(object.sudoers) + : undefined; + message.action = object.action ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/nibiru/sudo/v1/query.ts b/src/protojs/nibiru/sudo/v1/query.ts new file mode 100644 index 00000000..4efba155 --- /dev/null +++ b/src/protojs/nibiru/sudo/v1/query.ts @@ -0,0 +1,160 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Sudoers } from "./state"; + +export interface QuerySudoersRequest { +} + +/** QuerySudoersResponse indicates the successful execution of MsgEditSudeors. */ +export interface QuerySudoersResponse { + sudoers?: Sudoers; +} + +function createBaseQuerySudoersRequest(): QuerySudoersRequest { + return {}; +} + +export const QuerySudoersRequest = { + encode(_: QuerySudoersRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QuerySudoersRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySudoersRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QuerySudoersRequest { + return {}; + }, + + toJSON(_: QuerySudoersRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QuerySudoersRequest { + return QuerySudoersRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>(_: I): QuerySudoersRequest { + const message = createBaseQuerySudoersRequest(); + return message; + }, +}; + +function createBaseQuerySudoersResponse(): QuerySudoersResponse { + return { sudoers: undefined }; +} + +export const QuerySudoersResponse = { + encode(message: QuerySudoersResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.sudoers !== undefined) { + Sudoers.encode(message.sudoers, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QuerySudoersResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySudoersResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sudoers = Sudoers.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySudoersResponse { + return { sudoers: isSet(object.sudoers) ? Sudoers.fromJSON(object.sudoers) : undefined }; + }, + + toJSON(message: QuerySudoersResponse): unknown { + const obj: any = {}; + message.sudoers !== undefined && (obj.sudoers = message.sudoers ? Sudoers.toJSON(message.sudoers) : undefined); + return obj; + }, + + create, I>>(base?: I): QuerySudoersResponse { + return QuerySudoersResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QuerySudoersResponse { + const message = createBaseQuerySudoersResponse(); + message.sudoers = (object.sudoers !== undefined && object.sudoers !== null) + ? Sudoers.fromPartial(object.sudoers) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + QuerySudoers(request: QuerySudoersRequest): Promise; +} + +export const QueryServiceName = "nibiru.sudo.v1.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.QuerySudoers = this.QuerySudoers.bind(this); + } + QuerySudoers(request: QuerySudoersRequest): Promise { + const data = QuerySudoersRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "QuerySudoers", data); + return promise.then((data) => QuerySudoersResponse.decode(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/nibiru/sudo/v1/state.ts b/src/protojs/nibiru/sudo/v1/state.ts new file mode 100644 index 00000000..587e0d0e --- /dev/null +++ b/src/protojs/nibiru/sudo/v1/state.ts @@ -0,0 +1,169 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export interface Sudoers { + /** Root: The "root" user. */ + root: string; + /** Contracts: The set of contracts with elevated permissions. */ + contracts: string[]; +} + +/** GenesisState: State for migrations and genesis for the x/sudo module. */ +export interface GenesisState { + sudoers?: Sudoers; +} + +function createBaseSudoers(): Sudoers { + return { root: "", contracts: [] }; +} + +export const Sudoers = { + encode(message: Sudoers, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.root !== "") { + writer.uint32(10).string(message.root); + } + for (const v of message.contracts) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Sudoers { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSudoers(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.root = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contracts.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Sudoers { + return { + root: isSet(object.root) ? String(object.root) : "", + contracts: Array.isArray(object?.contracts) ? object.contracts.map((e: any) => String(e)) : [], + }; + }, + + toJSON(message: Sudoers): unknown { + const obj: any = {}; + message.root !== undefined && (obj.root = message.root); + if (message.contracts) { + obj.contracts = message.contracts.map((e) => e); + } else { + obj.contracts = []; + } + return obj; + }, + + create, I>>(base?: I): Sudoers { + return Sudoers.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): Sudoers { + const message = createBaseSudoers(); + message.root = object.root ?? ""; + message.contracts = object.contracts?.map((e) => e) || []; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { sudoers: undefined }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.sudoers !== undefined) { + Sudoers.encode(message.sudoers, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sudoers = Sudoers.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { sudoers: isSet(object.sudoers) ? Sudoers.fromJSON(object.sudoers) : undefined }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.sudoers !== undefined && (obj.sudoers = message.sudoers ? Sudoers.toJSON(message.sudoers) : undefined); + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.sudoers = (object.sudoers !== undefined && object.sudoers !== null) + ? Sudoers.fromPartial(object.sudoers) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/nibiru/sudo/v1/tx.ts b/src/protojs/nibiru/sudo/v1/tx.ts new file mode 100644 index 00000000..f59fc89c --- /dev/null +++ b/src/protojs/nibiru/sudo/v1/tx.ts @@ -0,0 +1,339 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +/** MsgEditSudoers: Msg to update the "Sudoers" state. */ +export interface MsgEditSudoers { + /** + * Action: identifier for the type of edit that will take place. Using this + * action field prevents us from needing to create several similar message + * types. + */ + action: string; + /** Contracts: An input payload. */ + contracts: string[]; + /** Sender: Address for the signer of the transaction. */ + sender: string; +} + +/** MsgEditSudoersResponse indicates the successful execution of MsgEditSudeors. */ +export interface MsgEditSudoersResponse { +} + +/** MsgChangeRoot: Msg to update the "Sudoers" state. */ +export interface MsgChangeRoot { + /** Sender: Address for the signer of the transaction. */ + sender: string; + /** NewRoot: New root address. */ + newRoot: string; +} + +/** MsgChangeRootResponse indicates the successful execution of MsgChangeRoot. */ +export interface MsgChangeRootResponse { +} + +function createBaseMsgEditSudoers(): MsgEditSudoers { + return { action: "", contracts: [], sender: "" }; +} + +export const MsgEditSudoers = { + encode(message: MsgEditSudoers, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.action !== "") { + writer.uint32(10).string(message.action); + } + for (const v of message.contracts) { + writer.uint32(18).string(v!); + } + if (message.sender !== "") { + writer.uint32(26).string(message.sender); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgEditSudoers { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgEditSudoers(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.action = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contracts.push(reader.string()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.sender = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgEditSudoers { + return { + action: isSet(object.action) ? String(object.action) : "", + contracts: Array.isArray(object?.contracts) ? object.contracts.map((e: any) => String(e)) : [], + sender: isSet(object.sender) ? String(object.sender) : "", + }; + }, + + toJSON(message: MsgEditSudoers): unknown { + const obj: any = {}; + message.action !== undefined && (obj.action = message.action); + if (message.contracts) { + obj.contracts = message.contracts.map((e) => e); + } else { + obj.contracts = []; + } + message.sender !== undefined && (obj.sender = message.sender); + return obj; + }, + + create, I>>(base?: I): MsgEditSudoers { + return MsgEditSudoers.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): MsgEditSudoers { + const message = createBaseMsgEditSudoers(); + message.action = object.action ?? ""; + message.contracts = object.contracts?.map((e) => e) || []; + message.sender = object.sender ?? ""; + return message; + }, +}; + +function createBaseMsgEditSudoersResponse(): MsgEditSudoersResponse { + return {}; +} + +export const MsgEditSudoersResponse = { + encode(_: MsgEditSudoersResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgEditSudoersResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgEditSudoersResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgEditSudoersResponse { + return {}; + }, + + toJSON(_: MsgEditSudoersResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgEditSudoersResponse { + return MsgEditSudoersResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(_: I): MsgEditSudoersResponse { + const message = createBaseMsgEditSudoersResponse(); + return message; + }, +}; + +function createBaseMsgChangeRoot(): MsgChangeRoot { + return { sender: "", newRoot: "" }; +} + +export const MsgChangeRoot = { + encode(message: MsgChangeRoot, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.newRoot !== "") { + writer.uint32(18).string(message.newRoot); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgChangeRoot { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChangeRoot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sender = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.newRoot = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgChangeRoot { + return { + sender: isSet(object.sender) ? String(object.sender) : "", + newRoot: isSet(object.newRoot) ? String(object.newRoot) : "", + }; + }, + + toJSON(message: MsgChangeRoot): unknown { + const obj: any = {}; + message.sender !== undefined && (obj.sender = message.sender); + message.newRoot !== undefined && (obj.newRoot = message.newRoot); + return obj; + }, + + create, I>>(base?: I): MsgChangeRoot { + return MsgChangeRoot.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): MsgChangeRoot { + const message = createBaseMsgChangeRoot(); + message.sender = object.sender ?? ""; + message.newRoot = object.newRoot ?? ""; + return message; + }, +}; + +function createBaseMsgChangeRootResponse(): MsgChangeRootResponse { + return {}; +} + +export const MsgChangeRootResponse = { + encode(_: MsgChangeRootResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgChangeRootResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChangeRootResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgChangeRootResponse { + return {}; + }, + + toJSON(_: MsgChangeRootResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgChangeRootResponse { + return MsgChangeRootResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(_: I): MsgChangeRootResponse { + const message = createBaseMsgChangeRootResponse(); + return message; + }, +}; + +/** + * Msg defines the x/sudo module's Msg service. Protobuf `Msg` services are + * called from `BaseApp` instances during `DeliverTx`. The `Msg` service will be + * responsible for processing `sdk.Msg` requests. + */ +export interface Msg { + /** EditSudoers updates the "Sudoers" state */ + EditSudoers(request: MsgEditSudoers): Promise; + ChangeRoot(request: MsgChangeRoot): Promise; +} + +export const MsgServiceName = "nibiru.sudo.v1.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.EditSudoers = this.EditSudoers.bind(this); + this.ChangeRoot = this.ChangeRoot.bind(this); + } + EditSudoers(request: MsgEditSudoers): Promise { + const data = MsgEditSudoers.encode(request).finish(); + const promise = this.rpc.request(this.service, "EditSudoers", data); + return promise.then((data) => MsgEditSudoersResponse.decode(_m0.Reader.create(data))); + } + + ChangeRoot(request: MsgChangeRoot): Promise { + const data = MsgChangeRoot.encode(request).finish(); + const promise = this.rpc.request(this.service, "ChangeRoot", data); + return promise.then((data) => MsgChangeRootResponse.decode(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/nibiru/tokenfactory/v1/event.ts b/src/protojs/nibiru/tokenfactory/v1/event.ts new file mode 100644 index 00000000..2bd1a599 --- /dev/null +++ b/src/protojs/nibiru/tokenfactory/v1/event.ts @@ -0,0 +1,468 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Metadata } from "../../../cosmos/bank/v1beta1/bank"; +import { Coin } from "../../../cosmos/base/v1beta1/coin"; + +export interface EventCreateDenom { + denom: string; + creator: string; +} + +export interface EventChangeAdmin { + denom: string; + newAdmin: string; + oldAdmin: string; +} + +export interface EventMint { + coin?: Coin; + toAddr: string; + caller: string; +} + +export interface EventBurn { + coin?: Coin; + fromAddr: string; + caller: string; +} + +export interface EventSetDenomMetadata { + denom: string; + /** + * Metadata: Official x/bank metadata for the denom. All token factory denoms + * are standard, native assets. The "metadata.base" is the denom. + */ + metadata?: Metadata; + caller: string; +} + +function createBaseEventCreateDenom(): EventCreateDenom { + return { denom: "", creator: "" }; +} + +export const EventCreateDenom = { + encode(message: EventCreateDenom, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventCreateDenom { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventCreateDenom(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventCreateDenom { + return { + denom: isSet(object.denom) ? String(object.denom) : "", + creator: isSet(object.creator) ? String(object.creator) : "", + }; + }, + + toJSON(message: EventCreateDenom): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom); + message.creator !== undefined && (obj.creator = message.creator); + return obj; + }, + + create, I>>(base?: I): EventCreateDenom { + return EventCreateDenom.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): EventCreateDenom { + const message = createBaseEventCreateDenom(); + message.denom = object.denom ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseEventChangeAdmin(): EventChangeAdmin { + return { denom: "", newAdmin: "", oldAdmin: "" }; +} + +export const EventChangeAdmin = { + encode(message: EventChangeAdmin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.newAdmin !== "") { + writer.uint32(18).string(message.newAdmin); + } + if (message.oldAdmin !== "") { + writer.uint32(26).string(message.oldAdmin); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventChangeAdmin { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventChangeAdmin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.newAdmin = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.oldAdmin = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventChangeAdmin { + return { + denom: isSet(object.denom) ? String(object.denom) : "", + newAdmin: isSet(object.newAdmin) ? String(object.newAdmin) : "", + oldAdmin: isSet(object.oldAdmin) ? String(object.oldAdmin) : "", + }; + }, + + toJSON(message: EventChangeAdmin): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom); + message.newAdmin !== undefined && (obj.newAdmin = message.newAdmin); + message.oldAdmin !== undefined && (obj.oldAdmin = message.oldAdmin); + return obj; + }, + + create, I>>(base?: I): EventChangeAdmin { + return EventChangeAdmin.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): EventChangeAdmin { + const message = createBaseEventChangeAdmin(); + message.denom = object.denom ?? ""; + message.newAdmin = object.newAdmin ?? ""; + message.oldAdmin = object.oldAdmin ?? ""; + return message; + }, +}; + +function createBaseEventMint(): EventMint { + return { coin: undefined, toAddr: "", caller: "" }; +} + +export const EventMint = { + encode(message: EventMint, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.coin !== undefined) { + Coin.encode(message.coin, writer.uint32(10).fork()).ldelim(); + } + if (message.toAddr !== "") { + writer.uint32(18).string(message.toAddr); + } + if (message.caller !== "") { + writer.uint32(26).string(message.caller); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventMint { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventMint(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.coin = Coin.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.toAddr = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.caller = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventMint { + return { + coin: isSet(object.coin) ? Coin.fromJSON(object.coin) : undefined, + toAddr: isSet(object.toAddr) ? String(object.toAddr) : "", + caller: isSet(object.caller) ? String(object.caller) : "", + }; + }, + + toJSON(message: EventMint): unknown { + const obj: any = {}; + message.coin !== undefined && (obj.coin = message.coin ? Coin.toJSON(message.coin) : undefined); + message.toAddr !== undefined && (obj.toAddr = message.toAddr); + message.caller !== undefined && (obj.caller = message.caller); + return obj; + }, + + create, I>>(base?: I): EventMint { + return EventMint.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): EventMint { + const message = createBaseEventMint(); + message.coin = (object.coin !== undefined && object.coin !== null) ? Coin.fromPartial(object.coin) : undefined; + message.toAddr = object.toAddr ?? ""; + message.caller = object.caller ?? ""; + return message; + }, +}; + +function createBaseEventBurn(): EventBurn { + return { coin: undefined, fromAddr: "", caller: "" }; +} + +export const EventBurn = { + encode(message: EventBurn, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.coin !== undefined) { + Coin.encode(message.coin, writer.uint32(10).fork()).ldelim(); + } + if (message.fromAddr !== "") { + writer.uint32(18).string(message.fromAddr); + } + if (message.caller !== "") { + writer.uint32(26).string(message.caller); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventBurn { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventBurn(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.coin = Coin.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fromAddr = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.caller = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventBurn { + return { + coin: isSet(object.coin) ? Coin.fromJSON(object.coin) : undefined, + fromAddr: isSet(object.fromAddr) ? String(object.fromAddr) : "", + caller: isSet(object.caller) ? String(object.caller) : "", + }; + }, + + toJSON(message: EventBurn): unknown { + const obj: any = {}; + message.coin !== undefined && (obj.coin = message.coin ? Coin.toJSON(message.coin) : undefined); + message.fromAddr !== undefined && (obj.fromAddr = message.fromAddr); + message.caller !== undefined && (obj.caller = message.caller); + return obj; + }, + + create, I>>(base?: I): EventBurn { + return EventBurn.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): EventBurn { + const message = createBaseEventBurn(); + message.coin = (object.coin !== undefined && object.coin !== null) ? Coin.fromPartial(object.coin) : undefined; + message.fromAddr = object.fromAddr ?? ""; + message.caller = object.caller ?? ""; + return message; + }, +}; + +function createBaseEventSetDenomMetadata(): EventSetDenomMetadata { + return { denom: "", metadata: undefined, caller: "" }; +} + +export const EventSetDenomMetadata = { + encode(message: EventSetDenomMetadata, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.metadata !== undefined) { + Metadata.encode(message.metadata, writer.uint32(18).fork()).ldelim(); + } + if (message.caller !== "") { + writer.uint32(26).string(message.caller); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventSetDenomMetadata { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventSetDenomMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.metadata = Metadata.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.caller = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventSetDenomMetadata { + return { + denom: isSet(object.denom) ? String(object.denom) : "", + metadata: isSet(object.metadata) ? Metadata.fromJSON(object.metadata) : undefined, + caller: isSet(object.caller) ? String(object.caller) : "", + }; + }, + + toJSON(message: EventSetDenomMetadata): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom); + message.metadata !== undefined && (obj.metadata = message.metadata ? Metadata.toJSON(message.metadata) : undefined); + message.caller !== undefined && (obj.caller = message.caller); + return obj; + }, + + create, I>>(base?: I): EventSetDenomMetadata { + return EventSetDenomMetadata.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): EventSetDenomMetadata { + const message = createBaseEventSetDenomMetadata(); + message.denom = object.denom ?? ""; + message.metadata = (object.metadata !== undefined && object.metadata !== null) + ? Metadata.fromPartial(object.metadata) + : undefined; + message.caller = object.caller ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/nibiru/tokenfactory/v1/query.ts b/src/protojs/nibiru/tokenfactory/v1/query.ts new file mode 100644 index 00000000..fc5dbe34 --- /dev/null +++ b/src/protojs/nibiru/tokenfactory/v1/query.ts @@ -0,0 +1,453 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Metadata } from "../../../cosmos/bank/v1beta1/bank"; +import { ModuleParams } from "./state"; + +/** 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 { + /** Module parameters stored in state */ + params?: ModuleParams; +} + +/** QueryDenomsRequest: gRPC query for all denoms registered for a creator */ +export interface QueryDenomsRequest { + creator: string; +} + +/** QueryDenomsResponse: All registered denoms for a creator */ +export interface QueryDenomsResponse { + denoms: string[]; +} + +/** QueryDenomInfoRequest: gRPC query for the denom admin and x/bank metadata */ +export interface QueryDenomInfoRequest { + denom: string; +} + +/** QueryDenomInfoResponse: All registered denoms for a creator */ +export interface QueryDenomInfoResponse { + /** Admin of the token factory denom */ + admin: string; + /** + * Metadata: Official x/bank metadata for the denom. All token factory denoms + * are standard, native assets. + */ + metadata?: Metadata; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest = { + encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse = { + encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + ModuleParams.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = ModuleParams.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? ModuleParams.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? ModuleParams.toJSON(message.params) : undefined); + return obj; + }, + + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = (object.params !== undefined && object.params !== null) + ? ModuleParams.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryDenomsRequest(): QueryDenomsRequest { + return { creator: "" }; +} + +export const QueryDenomsRequest = { + encode(message: QueryDenomsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDenomsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomsRequest { + return { creator: isSet(object.creator) ? String(object.creator) : "" }; + }, + + toJSON(message: QueryDenomsRequest): unknown { + const obj: any = {}; + message.creator !== undefined && (obj.creator = message.creator); + return obj; + }, + + create, I>>(base?: I): QueryDenomsRequest { + return QueryDenomsRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryDenomsRequest { + const message = createBaseQueryDenomsRequest(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseQueryDenomsResponse(): QueryDenomsResponse { + return { denoms: [] }; +} + +export const QueryDenomsResponse = { + encode(message: QueryDenomsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.denoms) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDenomsResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denoms.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomsResponse { + return { denoms: Array.isArray(object?.denoms) ? object.denoms.map((e: any) => String(e)) : [] }; + }, + + toJSON(message: QueryDenomsResponse): unknown { + const obj: any = {}; + if (message.denoms) { + obj.denoms = message.denoms.map((e) => e); + } else { + obj.denoms = []; + } + return obj; + }, + + create, I>>(base?: I): QueryDenomsResponse { + return QueryDenomsResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryDenomsResponse { + const message = createBaseQueryDenomsResponse(); + message.denoms = object.denoms?.map((e) => e) || []; + return message; + }, +}; + +function createBaseQueryDenomInfoRequest(): QueryDenomInfoRequest { + return { denom: "" }; +} + +export const QueryDenomInfoRequest = { + encode(message: QueryDenomInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDenomInfoRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomInfoRequest { + return { denom: isSet(object.denom) ? String(object.denom) : "" }; + }, + + toJSON(message: QueryDenomInfoRequest): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom); + return obj; + }, + + create, I>>(base?: I): QueryDenomInfoRequest { + return QueryDenomInfoRequest.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryDenomInfoRequest { + const message = createBaseQueryDenomInfoRequest(); + message.denom = object.denom ?? ""; + return message; + }, +}; + +function createBaseQueryDenomInfoResponse(): QueryDenomInfoResponse { + return { admin: "", metadata: undefined }; +} + +export const QueryDenomInfoResponse = { + encode(message: QueryDenomInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.metadata !== undefined) { + Metadata.encode(message.metadata, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDenomInfoResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.metadata = Metadata.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomInfoResponse { + return { + admin: isSet(object.admin) ? String(object.admin) : "", + metadata: isSet(object.metadata) ? Metadata.fromJSON(object.metadata) : undefined, + }; + }, + + toJSON(message: QueryDenomInfoResponse): unknown { + const obj: any = {}; + message.admin !== undefined && (obj.admin = message.admin); + message.metadata !== undefined && (obj.metadata = message.metadata ? Metadata.toJSON(message.metadata) : undefined); + return obj; + }, + + create, I>>(base?: I): QueryDenomInfoResponse { + return QueryDenomInfoResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): QueryDenomInfoResponse { + const message = createBaseQueryDenomInfoResponse(); + message.admin = object.admin ?? ""; + message.metadata = (object.metadata !== undefined && object.metadata !== null) + ? Metadata.fromPartial(object.metadata) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Params retrieves the module params */ + Params(request: QueryParamsRequest): Promise; + /** Denoms retrieves all registered denoms for a given creator */ + Denoms(request: QueryDenomsRequest): Promise; + /** DenomInfo retrieves the denom metadata and admin info */ + DenomInfo(request: QueryDenomInfoRequest): Promise; +} + +export const QueryServiceName = "nibiru.tokenfactory.v1.Query"; +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Denoms = this.Denoms.bind(this); + this.DenomInfo = this.DenomInfo.bind(this); + } + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => QueryParamsResponse.decode(_m0.Reader.create(data))); + } + + Denoms(request: QueryDenomsRequest): Promise { + const data = QueryDenomsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Denoms", data); + return promise.then((data) => QueryDenomsResponse.decode(_m0.Reader.create(data))); + } + + DenomInfo(request: QueryDenomInfoRequest): Promise { + const data = QueryDenomInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DenomInfo", data); + return promise.then((data) => QueryDenomInfoResponse.decode(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/nibiru/tokenfactory/v1/state.ts b/src/protojs/nibiru/tokenfactory/v1/state.ts new file mode 100644 index 00000000..aad1020b --- /dev/null +++ b/src/protojs/nibiru/tokenfactory/v1/state.ts @@ -0,0 +1,446 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +/** + * DenomAuthorityMetadata specifies metadata foraddresses that have specific + * capabilities over a token factory denom. Right now there is only one Admin + * permission, but is planned to be extended to the future. + */ +export interface DenomAuthorityMetadata { + /** + * Admin: Bech32 address of the admin for the tokefactory denom. Can be empty + * for no admin. + */ + admin: string; +} + +/** + * ModuleParams defines the parameters for the tokenfactory module. + * + * ### On Denom Creation Costs + * + * We'd like for fees to be paid by the user/signer of a ransaction, but in many + * casess, token creation is abstracted away behind a smart contract. Setting a + * nonzero `denom_creation_fee` would force each contract to handle collecting + * and paying a fees for denom (factory/{contract-addr}/{subdenom}) creation on + * behalf of the end user. + * + * For IBC token transfers, it's unclear who should pay the feeā€”the contract, + * the relayer, or the original sender? + * > "Charging fees will mess up composability, the same way Terra transfer tax + * caused all kinds of headaches for contract devs." - @ethanfrey + * + * ### Recommended Solution + * + * Have the end user (signer) pay fees directly in the form of higher gas costs. + * This way, contracts won't need to handle collecting or paying fees. And for + * IBC, the gas costs are already paid by the original sender and can be + * estimated by the relayer. It's easier to tune gas costs to make spam + * prohibitively expensive since there are per-transaction and per-block gas + * limits. + * + * See https://github.com/CosmWasm/token-factory/issues/11 for the initial + * discussion of the issue with @ethanfrey and @valardragon. + */ +export interface ModuleParams { + /** + * Adds gas consumption to the execution of `MsgCreateDenom` as a method of + * spam prevention. Defaults to 10 NIBI. + */ + denomCreationGasConsume: Long; +} + +/** + * TFDenom is a token factory (TF) denom. The canonical representation is + * "tf/{creator}/{subdenom}", its unique denomination in the x/bank module. + */ +export interface TFDenom { + /** Creator: Bech32 address of the creator of the denom. */ + creator: string; + /** + * Subdenom: Unique suffix of a token factory denom. A subdenom is specific + * to a given creator. It is the name given during a token factory "Mint". + */ + subdenom: string; +} + +/** GenesisState for the Token Factory module. */ +export interface GenesisState { + params?: ModuleParams; + factoryDenoms: GenesisDenom[]; +} + +/** GenesisDenom defines a tokenfactory denoms in the genesis state. */ +export interface GenesisDenom { + denom: string; + authorityMetadata?: DenomAuthorityMetadata; +} + +function createBaseDenomAuthorityMetadata(): DenomAuthorityMetadata { + return { admin: "" }; +} + +export const DenomAuthorityMetadata = { + encode(message: DenomAuthorityMetadata, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DenomAuthorityMetadata { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDenomAuthorityMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DenomAuthorityMetadata { + return { admin: isSet(object.admin) ? String(object.admin) : "" }; + }, + + toJSON(message: DenomAuthorityMetadata): unknown { + const obj: any = {}; + message.admin !== undefined && (obj.admin = message.admin); + return obj; + }, + + create, I>>(base?: I): DenomAuthorityMetadata { + return DenomAuthorityMetadata.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): DenomAuthorityMetadata { + const message = createBaseDenomAuthorityMetadata(); + message.admin = object.admin ?? ""; + return message; + }, +}; + +function createBaseModuleParams(): ModuleParams { + return { denomCreationGasConsume: Long.UZERO }; +} + +export const ModuleParams = { + encode(message: ModuleParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (!message.denomCreationGasConsume.isZero()) { + writer.uint32(8).uint64(message.denomCreationGasConsume); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ModuleParams { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.denomCreationGasConsume = reader.uint64() as Long; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleParams { + return { + denomCreationGasConsume: isSet(object.denomCreationGasConsume) + ? Long.fromValue(object.denomCreationGasConsume) + : Long.UZERO, + }; + }, + + toJSON(message: ModuleParams): unknown { + const obj: any = {}; + message.denomCreationGasConsume !== undefined && + (obj.denomCreationGasConsume = (message.denomCreationGasConsume || Long.UZERO).toString()); + return obj; + }, + + create, I>>(base?: I): ModuleParams { + return ModuleParams.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): ModuleParams { + const message = createBaseModuleParams(); + message.denomCreationGasConsume = + (object.denomCreationGasConsume !== undefined && object.denomCreationGasConsume !== null) + ? Long.fromValue(object.denomCreationGasConsume) + : Long.UZERO; + return message; + }, +}; + +function createBaseTFDenom(): TFDenom { + return { creator: "", subdenom: "" }; +} + +export const TFDenom = { + encode(message: TFDenom, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.subdenom !== "") { + writer.uint32(18).string(message.subdenom); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TFDenom { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTFDenom(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.subdenom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): TFDenom { + return { + creator: isSet(object.creator) ? String(object.creator) : "", + subdenom: isSet(object.subdenom) ? String(object.subdenom) : "", + }; + }, + + toJSON(message: TFDenom): unknown { + const obj: any = {}; + message.creator !== undefined && (obj.creator = message.creator); + message.subdenom !== undefined && (obj.subdenom = message.subdenom); + return obj; + }, + + create, I>>(base?: I): TFDenom { + return TFDenom.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): TFDenom { + const message = createBaseTFDenom(); + message.creator = object.creator ?? ""; + message.subdenom = object.subdenom ?? ""; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { params: undefined, factoryDenoms: [] }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + ModuleParams.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.factoryDenoms) { + GenesisDenom.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = ModuleParams.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.factoryDenoms.push(GenesisDenom.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? ModuleParams.fromJSON(object.params) : undefined, + factoryDenoms: Array.isArray(object?.factoryDenoms) + ? object.factoryDenoms.map((e: any) => GenesisDenom.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? ModuleParams.toJSON(message.params) : undefined); + if (message.factoryDenoms) { + obj.factoryDenoms = message.factoryDenoms.map((e) => e ? GenesisDenom.toJSON(e) : undefined); + } else { + obj.factoryDenoms = []; + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.params = (object.params !== undefined && object.params !== null) + ? ModuleParams.fromPartial(object.params) + : undefined; + message.factoryDenoms = object.factoryDenoms?.map((e) => GenesisDenom.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGenesisDenom(): GenesisDenom { + return { denom: "", authorityMetadata: undefined }; +} + +export const GenesisDenom = { + encode(message: GenesisDenom, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.authorityMetadata !== undefined) { + DenomAuthorityMetadata.encode(message.authorityMetadata, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisDenom { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisDenom(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authorityMetadata = DenomAuthorityMetadata.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisDenom { + return { + denom: isSet(object.denom) ? String(object.denom) : "", + authorityMetadata: isSet(object.authorityMetadata) + ? DenomAuthorityMetadata.fromJSON(object.authorityMetadata) + : undefined, + }; + }, + + toJSON(message: GenesisDenom): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom); + message.authorityMetadata !== undefined && (obj.authorityMetadata = message.authorityMetadata + ? DenomAuthorityMetadata.toJSON(message.authorityMetadata) + : undefined); + return obj; + }, + + create, I>>(base?: I): GenesisDenom { + return GenesisDenom.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): GenesisDenom { + const message = createBaseGenesisDenom(); + message.denom = object.denom ?? ""; + message.authorityMetadata = (object.authorityMetadata !== undefined && object.authorityMetadata !== null) + ? DenomAuthorityMetadata.fromPartial(object.authorityMetadata) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protojs/nibiru/tokenfactory/v1/tx.ts b/src/protojs/nibiru/tokenfactory/v1/tx.ts new file mode 100644 index 00000000..8532cf2f --- /dev/null +++ b/src/protojs/nibiru/tokenfactory/v1/tx.ts @@ -0,0 +1,1085 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Metadata } from "../../../cosmos/bank/v1beta1/bank"; +import { Coin } from "../../../cosmos/base/v1beta1/coin"; +import { ModuleParams } from "./state"; + +/** + * MsgCreateDenom: sdk.Msg that registers an a token factory denom. + * A denom has the form "tf/[creatorAddr]/[subdenom]". + * - Denoms become unique x/bank tokens, so the creator-subdenom pair that + * defines a denom cannot be reused. + * - The resulting denom's admin is originally set to be the creator, but the + * admin can be changed later. + */ +export interface MsgCreateDenom { + sender: string; + /** subdenom can be up to 44 "alphanumeric" characters long. */ + subdenom: string; +} + +/** MsgCreateDenomResponse is the return value of MsgCreateDenom */ +export interface MsgCreateDenomResponse { + /** NewTokenDenom: identifier for the newly created token factory denom. */ + newTokenDenom: string; +} + +/** + * MsgChangeAdmin is the sdk.Msg type for allowing an admin account to change + * admin of a denom to a new account + */ +export interface MsgChangeAdmin { + sender: string; + denom: string; + newAdmin: string; +} + +/** MsgChangeAdminResponse is the gRPC response for the MsgChangeAdmin TxMsg. */ +export interface MsgChangeAdminResponse { +} + +/** MsgUpdateModuleParams: sdk.Msg for updating the x/tokenfactory module params */ +export interface MsgUpdateModuleParams { + /** Authority: Address of the governance module account. */ + authority: string; + params?: ModuleParams; +} + +/** + * MsgUpdateModuleParamsResponse is the gRPC response for the + * MsgUpdateModuleParams TxMsg. + */ +export interface MsgUpdateModuleParamsResponse { +} + +/** MsgMint: sdk.Msg (TxMsg) where an denom admin mints more of the token. */ +export interface MsgMint { + sender: string; + /** coin: The denom identifier and amount to mint. */ + coin?: Coin; + /** + * mint_to_addr: An address to which tokens will be minted. If blank, + * tokens are minted to the "sender". + */ + mintTo: string; +} + +export interface MsgMintResponse { + mintTo: string; +} + +/** + * MsgBurn: sdk.Msg (TxMsg) where a denom admin burns some of the token. + * The reason that the sender isn't automatically the "burn_from" address + * is to support smart contracts (primary use case). In this situation, the + * contract is the message signer and sender, while "burn_from" is based on the + * contract logic. + */ +export interface MsgBurn { + sender: string; + /** coin: The denom identifier and amount to burn. */ + coin?: Coin; + /** burn_from: The address from which tokens will be burned. */ + burnFrom: string; +} + +export interface MsgBurnResponse { +} + +/** + * MsgSetDenomMetadata: sdk.Msg (TxMsg) enabling the denom admin to change its + * bank metadata. + */ +export interface MsgSetDenomMetadata { + sender: string; + /** + * Metadata: Official x/bank metadata for the denom. All token factory denoms + * are standard, native assets. The "metadata.base" is the denom. + */ + metadata?: Metadata; +} + +export interface MsgSetDenomMetadataResponse { +} + +/** Burn a native token such as unibi */ +export interface MsgBurnNative { + sender: string; + coin?: Coin; +} + +export interface MsgBurnNativeResponse { +} + +function createBaseMsgCreateDenom(): MsgCreateDenom { + return { sender: "", subdenom: "" }; +} + +export const MsgCreateDenom = { + encode(message: MsgCreateDenom, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.subdenom !== "") { + writer.uint32(18).string(message.subdenom); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateDenom { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateDenom(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sender = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.subdenom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateDenom { + return { + sender: isSet(object.sender) ? String(object.sender) : "", + subdenom: isSet(object.subdenom) ? String(object.subdenom) : "", + }; + }, + + toJSON(message: MsgCreateDenom): unknown { + const obj: any = {}; + message.sender !== undefined && (obj.sender = message.sender); + message.subdenom !== undefined && (obj.subdenom = message.subdenom); + return obj; + }, + + create, I>>(base?: I): MsgCreateDenom { + return MsgCreateDenom.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): MsgCreateDenom { + const message = createBaseMsgCreateDenom(); + message.sender = object.sender ?? ""; + message.subdenom = object.subdenom ?? ""; + return message; + }, +}; + +function createBaseMsgCreateDenomResponse(): MsgCreateDenomResponse { + return { newTokenDenom: "" }; +} + +export const MsgCreateDenomResponse = { + encode(message: MsgCreateDenomResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.newTokenDenom !== "") { + writer.uint32(10).string(message.newTokenDenom); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateDenomResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateDenomResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.newTokenDenom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateDenomResponse { + return { newTokenDenom: isSet(object.newTokenDenom) ? String(object.newTokenDenom) : "" }; + }, + + toJSON(message: MsgCreateDenomResponse): unknown { + const obj: any = {}; + message.newTokenDenom !== undefined && (obj.newTokenDenom = message.newTokenDenom); + return obj; + }, + + create, I>>(base?: I): MsgCreateDenomResponse { + return MsgCreateDenomResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): MsgCreateDenomResponse { + const message = createBaseMsgCreateDenomResponse(); + message.newTokenDenom = object.newTokenDenom ?? ""; + return message; + }, +}; + +function createBaseMsgChangeAdmin(): MsgChangeAdmin { + return { sender: "", denom: "", newAdmin: "" }; +} + +export const MsgChangeAdmin = { + encode(message: MsgChangeAdmin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + if (message.newAdmin !== "") { + writer.uint32(26).string(message.newAdmin); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgChangeAdmin { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChangeAdmin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sender = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.denom = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.newAdmin = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgChangeAdmin { + return { + sender: isSet(object.sender) ? String(object.sender) : "", + denom: isSet(object.denom) ? String(object.denom) : "", + newAdmin: isSet(object.newAdmin) ? String(object.newAdmin) : "", + }; + }, + + toJSON(message: MsgChangeAdmin): unknown { + const obj: any = {}; + message.sender !== undefined && (obj.sender = message.sender); + message.denom !== undefined && (obj.denom = message.denom); + message.newAdmin !== undefined && (obj.newAdmin = message.newAdmin); + return obj; + }, + + create, I>>(base?: I): MsgChangeAdmin { + return MsgChangeAdmin.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): MsgChangeAdmin { + const message = createBaseMsgChangeAdmin(); + message.sender = object.sender ?? ""; + message.denom = object.denom ?? ""; + message.newAdmin = object.newAdmin ?? ""; + return message; + }, +}; + +function createBaseMsgChangeAdminResponse(): MsgChangeAdminResponse { + return {}; +} + +export const MsgChangeAdminResponse = { + encode(_: MsgChangeAdminResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgChangeAdminResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChangeAdminResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgChangeAdminResponse { + return {}; + }, + + toJSON(_: MsgChangeAdminResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgChangeAdminResponse { + return MsgChangeAdminResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(_: I): MsgChangeAdminResponse { + const message = createBaseMsgChangeAdminResponse(); + return message; + }, +}; + +function createBaseMsgUpdateModuleParams(): MsgUpdateModuleParams { + return { authority: "", params: undefined }; +} + +export const MsgUpdateModuleParams = { + encode(message: MsgUpdateModuleParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + ModuleParams.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateModuleParams { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateModuleParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = ModuleParams.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateModuleParams { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + params: isSet(object.params) ? ModuleParams.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: MsgUpdateModuleParams): unknown { + const obj: any = {}; + message.authority !== undefined && (obj.authority = message.authority); + message.params !== undefined && (obj.params = message.params ? ModuleParams.toJSON(message.params) : undefined); + return obj; + }, + + create, I>>(base?: I): MsgUpdateModuleParams { + return MsgUpdateModuleParams.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): MsgUpdateModuleParams { + const message = createBaseMsgUpdateModuleParams(); + message.authority = object.authority ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? ModuleParams.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateModuleParamsResponse(): MsgUpdateModuleParamsResponse { + return {}; +} + +export const MsgUpdateModuleParamsResponse = { + encode(_: MsgUpdateModuleParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateModuleParamsResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateModuleParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateModuleParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateModuleParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateModuleParamsResponse { + return MsgUpdateModuleParamsResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(_: I): MsgUpdateModuleParamsResponse { + const message = createBaseMsgUpdateModuleParamsResponse(); + return message; + }, +}; + +function createBaseMsgMint(): MsgMint { + return { sender: "", coin: undefined, mintTo: "" }; +} + +export const MsgMint = { + encode(message: MsgMint, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.coin !== undefined) { + Coin.encode(message.coin, writer.uint32(18).fork()).ldelim(); + } + if (message.mintTo !== "") { + writer.uint32(26).string(message.mintTo); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgMint { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgMint(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sender = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.coin = Coin.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.mintTo = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgMint { + return { + sender: isSet(object.sender) ? String(object.sender) : "", + coin: isSet(object.coin) ? Coin.fromJSON(object.coin) : undefined, + mintTo: isSet(object.mintTo) ? String(object.mintTo) : "", + }; + }, + + toJSON(message: MsgMint): unknown { + const obj: any = {}; + message.sender !== undefined && (obj.sender = message.sender); + message.coin !== undefined && (obj.coin = message.coin ? Coin.toJSON(message.coin) : undefined); + message.mintTo !== undefined && (obj.mintTo = message.mintTo); + return obj; + }, + + create, I>>(base?: I): MsgMint { + return MsgMint.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): MsgMint { + const message = createBaseMsgMint(); + message.sender = object.sender ?? ""; + message.coin = (object.coin !== undefined && object.coin !== null) ? Coin.fromPartial(object.coin) : undefined; + message.mintTo = object.mintTo ?? ""; + return message; + }, +}; + +function createBaseMsgMintResponse(): MsgMintResponse { + return { mintTo: "" }; +} + +export const MsgMintResponse = { + encode(message: MsgMintResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.mintTo !== "") { + writer.uint32(10).string(message.mintTo); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgMintResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgMintResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.mintTo = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgMintResponse { + return { mintTo: isSet(object.mintTo) ? String(object.mintTo) : "" }; + }, + + toJSON(message: MsgMintResponse): unknown { + const obj: any = {}; + message.mintTo !== undefined && (obj.mintTo = message.mintTo); + return obj; + }, + + create, I>>(base?: I): MsgMintResponse { + return MsgMintResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): MsgMintResponse { + const message = createBaseMsgMintResponse(); + message.mintTo = object.mintTo ?? ""; + return message; + }, +}; + +function createBaseMsgBurn(): MsgBurn { + return { sender: "", coin: undefined, burnFrom: "" }; +} + +export const MsgBurn = { + encode(message: MsgBurn, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.coin !== undefined) { + Coin.encode(message.coin, writer.uint32(18).fork()).ldelim(); + } + if (message.burnFrom !== "") { + writer.uint32(26).string(message.burnFrom); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgBurn { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgBurn(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sender = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.coin = Coin.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.burnFrom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgBurn { + return { + sender: isSet(object.sender) ? String(object.sender) : "", + coin: isSet(object.coin) ? Coin.fromJSON(object.coin) : undefined, + burnFrom: isSet(object.burnFrom) ? String(object.burnFrom) : "", + }; + }, + + toJSON(message: MsgBurn): unknown { + const obj: any = {}; + message.sender !== undefined && (obj.sender = message.sender); + message.coin !== undefined && (obj.coin = message.coin ? Coin.toJSON(message.coin) : undefined); + message.burnFrom !== undefined && (obj.burnFrom = message.burnFrom); + return obj; + }, + + create, I>>(base?: I): MsgBurn { + return MsgBurn.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): MsgBurn { + const message = createBaseMsgBurn(); + message.sender = object.sender ?? ""; + message.coin = (object.coin !== undefined && object.coin !== null) ? Coin.fromPartial(object.coin) : undefined; + message.burnFrom = object.burnFrom ?? ""; + return message; + }, +}; + +function createBaseMsgBurnResponse(): MsgBurnResponse { + return {}; +} + +export const MsgBurnResponse = { + encode(_: MsgBurnResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgBurnResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgBurnResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgBurnResponse { + return {}; + }, + + toJSON(_: MsgBurnResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgBurnResponse { + return MsgBurnResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(_: I): MsgBurnResponse { + const message = createBaseMsgBurnResponse(); + return message; + }, +}; + +function createBaseMsgSetDenomMetadata(): MsgSetDenomMetadata { + return { sender: "", metadata: undefined }; +} + +export const MsgSetDenomMetadata = { + encode(message: MsgSetDenomMetadata, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.metadata !== undefined) { + Metadata.encode(message.metadata, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetDenomMetadata { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetDenomMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sender = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.metadata = Metadata.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSetDenomMetadata { + return { + sender: isSet(object.sender) ? String(object.sender) : "", + metadata: isSet(object.metadata) ? Metadata.fromJSON(object.metadata) : undefined, + }; + }, + + toJSON(message: MsgSetDenomMetadata): unknown { + const obj: any = {}; + message.sender !== undefined && (obj.sender = message.sender); + message.metadata !== undefined && (obj.metadata = message.metadata ? Metadata.toJSON(message.metadata) : undefined); + return obj; + }, + + create, I>>(base?: I): MsgSetDenomMetadata { + return MsgSetDenomMetadata.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): MsgSetDenomMetadata { + const message = createBaseMsgSetDenomMetadata(); + message.sender = object.sender ?? ""; + message.metadata = (object.metadata !== undefined && object.metadata !== null) + ? Metadata.fromPartial(object.metadata) + : undefined; + return message; + }, +}; + +function createBaseMsgSetDenomMetadataResponse(): MsgSetDenomMetadataResponse { + return {}; +} + +export const MsgSetDenomMetadataResponse = { + encode(_: MsgSetDenomMetadataResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetDenomMetadataResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetDenomMetadataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSetDenomMetadataResponse { + return {}; + }, + + toJSON(_: MsgSetDenomMetadataResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSetDenomMetadataResponse { + return MsgSetDenomMetadataResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(_: I): MsgSetDenomMetadataResponse { + const message = createBaseMsgSetDenomMetadataResponse(); + return message; + }, +}; + +function createBaseMsgBurnNative(): MsgBurnNative { + return { sender: "", coin: undefined }; +} + +export const MsgBurnNative = { + encode(message: MsgBurnNative, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.coin !== undefined) { + Coin.encode(message.coin, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgBurnNative { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgBurnNative(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sender = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.coin = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgBurnNative { + return { + sender: isSet(object.sender) ? String(object.sender) : "", + coin: isSet(object.coin) ? Coin.fromJSON(object.coin) : undefined, + }; + }, + + toJSON(message: MsgBurnNative): unknown { + const obj: any = {}; + message.sender !== undefined && (obj.sender = message.sender); + message.coin !== undefined && (obj.coin = message.coin ? Coin.toJSON(message.coin) : undefined); + return obj; + }, + + create, I>>(base?: I): MsgBurnNative { + return MsgBurnNative.fromPartial(base ?? {}); + }, + + fromPartial, I>>(object: I): MsgBurnNative { + const message = createBaseMsgBurnNative(); + message.sender = object.sender ?? ""; + message.coin = (object.coin !== undefined && object.coin !== null) ? Coin.fromPartial(object.coin) : undefined; + return message; + }, +}; + +function createBaseMsgBurnNativeResponse(): MsgBurnNativeResponse { + return {}; +} + +export const MsgBurnNativeResponse = { + encode(_: MsgBurnNativeResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgBurnNativeResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgBurnNativeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgBurnNativeResponse { + return {}; + }, + + toJSON(_: MsgBurnNativeResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgBurnNativeResponse { + return MsgBurnNativeResponse.fromPartial(base ?? {}); + }, + + fromPartial, I>>(_: I): MsgBurnNativeResponse { + const message = createBaseMsgBurnNativeResponse(); + return message; + }, +}; + +/** Msg defines the gRPC Msg service for transactions. */ +export interface Msg { + /** CreateDenom: registers a token factory denom. */ + CreateDenom(request: MsgCreateDenom): Promise; + ChangeAdmin(request: MsgChangeAdmin): Promise; + /** + * UpdateModuleParams: A governance operation for updating the x/tokenfactory + * module parameters. + */ + UpdateModuleParams(request: MsgUpdateModuleParams): Promise; + Mint(request: MsgMint): Promise; + Burn(request: MsgBurn): Promise; + SetDenomMetadata(request: MsgSetDenomMetadata): Promise; + /** burns a native token such as unibi */ + BurnNative(request: MsgBurnNative): Promise; +} + +export const MsgServiceName = "nibiru.tokenfactory.v1.Msg"; +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.CreateDenom = this.CreateDenom.bind(this); + this.ChangeAdmin = this.ChangeAdmin.bind(this); + this.UpdateModuleParams = this.UpdateModuleParams.bind(this); + this.Mint = this.Mint.bind(this); + this.Burn = this.Burn.bind(this); + this.SetDenomMetadata = this.SetDenomMetadata.bind(this); + this.BurnNative = this.BurnNative.bind(this); + } + CreateDenom(request: MsgCreateDenom): Promise { + const data = MsgCreateDenom.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateDenom", data); + return promise.then((data) => MsgCreateDenomResponse.decode(_m0.Reader.create(data))); + } + + ChangeAdmin(request: MsgChangeAdmin): Promise { + const data = MsgChangeAdmin.encode(request).finish(); + const promise = this.rpc.request(this.service, "ChangeAdmin", data); + return promise.then((data) => MsgChangeAdminResponse.decode(_m0.Reader.create(data))); + } + + UpdateModuleParams(request: MsgUpdateModuleParams): Promise { + const data = MsgUpdateModuleParams.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateModuleParams", data); + return promise.then((data) => MsgUpdateModuleParamsResponse.decode(_m0.Reader.create(data))); + } + + Mint(request: MsgMint): Promise { + const data = MsgMint.encode(request).finish(); + const promise = this.rpc.request(this.service, "Mint", data); + return promise.then((data) => MsgMintResponse.decode(_m0.Reader.create(data))); + } + + Burn(request: MsgBurn): Promise { + const data = MsgBurn.encode(request).finish(); + const promise = this.rpc.request(this.service, "Burn", data); + return promise.then((data) => MsgBurnResponse.decode(_m0.Reader.create(data))); + } + + SetDenomMetadata(request: MsgSetDenomMetadata): Promise { + const data = MsgSetDenomMetadata.encode(request).finish(); + const promise = this.rpc.request(this.service, "SetDenomMetadata", data); + return promise.then((data) => MsgSetDenomMetadataResponse.decode(_m0.Reader.create(data))); + } + + BurnNative(request: MsgBurnNative): Promise { + const data = MsgBurnNative.encode(request).finish(); + const promise = this.rpc.request(this.service, "BurnNative", data); + return promise.then((data) => MsgBurnNativeResponse.decode(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin ? T + : T extends Long ? string | number | Long : T extends Array ? Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +}