├── .gitignore ├── README.md ├── okexchain-java-sdk.iml ├── okexchain-java-sdk.iws ├── pom.xml └── src ├── main ├── java │ └── com │ │ └── okexchain │ │ ├── env │ │ ├── EnvBase.java │ │ └── EnvInstance.java │ │ ├── msg │ │ ├── MsgBase.java │ │ ├── ammswap │ │ │ ├── MsgAddLiquidity.java │ │ │ ├── MsgAddLiquidityValue.java │ │ │ ├── MsgCreateExchange.java │ │ │ ├── MsgCreateExchangeValue.java │ │ │ ├── MsgRemoveLiquidity.java │ │ │ ├── MsgRemoveLiquidityValue.java │ │ │ ├── MsgSwapToken.java │ │ │ └── MsgSwapTokenValue.java │ │ ├── common │ │ │ ├── Block_methods.java │ │ │ ├── CommissionMsg.java │ │ │ ├── Contract_addresses.java │ │ │ ├── CounterParty.java │ │ │ ├── Data2Sign.java │ │ │ ├── DecCoin.java │ │ │ ├── DenomTrace.java │ │ │ ├── Description.java │ │ │ ├── Fee.java │ │ │ ├── Height.java │ │ │ ├── InputOutput.java │ │ │ ├── Message.java │ │ │ ├── Pagination.java │ │ │ ├── Paging.java │ │ │ ├── Pair.java │ │ │ ├── Pubkey.java │ │ │ ├── Result.java │ │ │ ├── Signature.java │ │ │ ├── TimeoutHeight.java │ │ │ ├── Token.java │ │ │ ├── TransferUnit.java │ │ │ ├── Treasures.java │ │ │ └── TxValue.java │ │ ├── dex │ │ │ ├── MsgConfirmTokenPairOwnership.java │ │ │ ├── MsgConfirmTokenPairOwnershipValue.java │ │ │ ├── MsgCreateOperator.java │ │ │ ├── MsgCreateOperatorValue.java │ │ │ ├── MsgDeposit.java │ │ │ ├── MsgDepositValue.java │ │ │ ├── MsgList.java │ │ │ ├── MsgListValue.java │ │ │ ├── MsgTransferTokenPairOwnership.java │ │ │ ├── MsgTransferTokenPairOwnershipValue.java │ │ │ ├── MsgUpdateOperator.java │ │ │ ├── MsgUpdateOperatorValue.java │ │ │ ├── MsgWithdrawDeposit.java │ │ │ └── MsgWithdrawDepositValue.java │ │ ├── distribution │ │ │ ├── MsgModifyWithdrawAddress.java │ │ │ ├── MsgModifyWithdrawAddressValue.java │ │ │ ├── MsgWithdrawReward.java │ │ │ └── MsgWithdrawRewardValue.java │ │ ├── farm │ │ │ ├── MsgClaim.java │ │ │ ├── MsgClaimValue.java │ │ │ ├── MsgCreatePool.java │ │ │ ├── MsgCreatePoolValue.java │ │ │ ├── MsgDestroyPool.java │ │ │ ├── MsgDestroyPoolValue.java │ │ │ ├── MsgLock.java │ │ │ ├── MsgLockValue.java │ │ │ ├── MsgProvide.java │ │ │ ├── MsgProvideValue.java │ │ │ ├── MsgUnlock.java │ │ │ └── MsgUnlockValue.java │ │ ├── feesplit │ │ │ ├── FeesplitQuery.java │ │ │ ├── MsgCancelFeeSplit.java │ │ │ ├── MsgCancelFeeSplitValue.java │ │ │ ├── MsgRegisterFeeSplit.java │ │ │ ├── MsgRegisterFeeSplitValue.java │ │ │ ├── MsgUpdateFeeSplit.java │ │ │ └── MsgUpdateFeeSplitValue.java │ │ ├── gov │ │ │ ├── Content.java │ │ │ ├── MsgChangeDistributionTypeProposal.java │ │ │ ├── MsgChangeDistributionTypeProposalValue.java │ │ │ ├── MsgClientUpdateProposal.java │ │ │ ├── MsgClientUpdateProposalValue.java │ │ │ ├── MsgContractBlockedListProposal.java │ │ │ ├── MsgContractBlockedListProposalValue.java │ │ │ ├── MsgContractDeploymentWhitelistProposal.java │ │ │ ├── MsgContractDeploymentWhitelistProposalValue.java │ │ │ ├── MsgContractManageTreasuresProposal.java │ │ │ ├── MsgContractManageTreasuresProposalValue.java │ │ │ ├── MsgContractMethodBlockedListProposal.java │ │ │ ├── MsgContractMethodBlockedListProposalValue.java │ │ │ ├── MsgContractTemplateProposal.java │ │ │ ├── MsgContractTemplateProposalValue.java │ │ │ ├── MsgDeListProposal.java │ │ │ ├── MsgDeListProposalValue.java │ │ │ ├── MsgDeposit.java │ │ │ ├── MsgDepositValue.java │ │ │ ├── MsgManageContractBytecodeProposal.java │ │ │ ├── MsgManageContractBytecodeProposalValue.java │ │ │ ├── MsgManageSysContractAddressProposal.java │ │ │ ├── MsgManageSysContractAddressProposalValue.java │ │ │ ├── MsgManageWhiteListProposal.java │ │ │ ├── MsgManageWhiteListProposalValue.java │ │ │ ├── MsgModifyNextBlockUpdateProposal.java │ │ │ ├── MsgParamChangeValue.java │ │ │ ├── MsgParameterChangeProposal.java │ │ │ ├── MsgParameterChangeProposalValue.java │ │ │ ├── MsgParameterChangeProposalWrapperValue.java │ │ │ ├── MsgProxyContractRedirectProposal.java │ │ │ ├── MsgProxyContractRedirectProposalValue.java │ │ │ ├── MsgRewardTruncatePrecisionProposal.java │ │ │ ├── MsgRewardTruncatePrecisionProposalValue.java │ │ │ ├── MsgSubmitProposalValue.java │ │ │ ├── MsgTokenMappingProposal.java │ │ │ ├── MsgTokenMappingProposalValue.java │ │ │ ├── MsgUpgradeProposal.java │ │ │ ├── MsgVote.java │ │ │ ├── MsgVoteValue.java │ │ │ ├── MsgWithdrawRewardEnabledProposal.java │ │ │ ├── MsgWithdrawRewardEnabledProposalValue.java │ │ │ ├── UniversalProposal.java │ │ │ ├── feesplit │ │ │ │ ├── MsgFeeSplitSharesProposal.java │ │ │ │ ├── MsgFeeSplitSharesProposalValue.java │ │ │ │ └── Share.java │ │ │ └── wasm │ │ │ │ ├── BlockedMethod.java │ │ │ │ ├── Method.java │ │ │ │ ├── MsgClearAdminProposal.java │ │ │ │ ├── MsgClearAdminProposalValue.java │ │ │ │ ├── MsgExtraProposal.java │ │ │ │ ├── MsgMigrateContractProposal.java │ │ │ │ ├── MsgMigrateContractProposalValue.java │ │ │ │ ├── MsgPinCodesProposal.java │ │ │ │ ├── MsgPinCodesProposalValue.java │ │ │ │ ├── MsgUnpinCodesProposal.java │ │ │ │ ├── MsgUnpinCodesProposalValue.java │ │ │ │ ├── MsgUpdateAdminProposal.java │ │ │ │ ├── MsgUpdateAdminProposalValue.java │ │ │ │ ├── MsgUpdateDeploymentWhitelistProposal.java │ │ │ │ ├── MsgUpdateDeploymentWhitelistProposalValue.java │ │ │ │ ├── MsgUpdateWASMContractMethodBlockedListProposal.java │ │ │ │ └── MsgUpdateWASMContractMethodBlockedListProposalValue.java │ │ ├── ibc │ │ │ ├── ChannelQuery.java │ │ │ ├── ClientQuery.java │ │ │ ├── ConnectionQuery.java │ │ │ ├── HeaderQuery.java │ │ │ ├── TransferMsg.java │ │ │ ├── TransferMsgValue.java │ │ │ ├── TransferQuery.java │ │ │ ├── TxQuery.java │ │ │ ├── channel │ │ │ │ ├── Channel.java │ │ │ │ ├── ChannelResponse.java │ │ │ │ ├── Channels.java │ │ │ │ ├── ChannelsResponse.java │ │ │ │ ├── Commitment.java │ │ │ │ ├── ConnectionChannelsResponse.java │ │ │ │ └── PacketCommitmentResponse.java │ │ │ ├── client │ │ │ │ ├── ClientState.java │ │ │ │ ├── ClientStateResponse.java │ │ │ │ ├── ClientStates.java │ │ │ │ ├── ClientStatesResponse.java │ │ │ │ ├── InnerSpec.java │ │ │ │ ├── LeafSpec.java │ │ │ │ ├── ProofSpecs.java │ │ │ │ └── TrustLevel.java │ │ │ ├── connection │ │ │ │ ├── ClientConnectionsResponse.java │ │ │ │ ├── Connection.java │ │ │ │ ├── ConnectionResponse.java │ │ │ │ ├── Connections.java │ │ │ │ ├── ConnectionsResponse.java │ │ │ │ ├── CounterPartyPrefix.java │ │ │ │ ├── Prefix.java │ │ │ │ └── Versions.java │ │ │ ├── transfer │ │ │ │ ├── DenomTraceResponse.java │ │ │ │ ├── DenomTracesResponse.java │ │ │ │ ├── Params.java │ │ │ │ └── ParamsResponse.java │ │ │ └── tx │ │ │ │ └── TxEvent.java │ │ ├── order │ │ │ ├── MsgCancelOrders.java │ │ │ ├── MsgCancelOrdersValue.java │ │ │ ├── MsgNewOrders.java │ │ │ ├── MsgNewOrdersValue.java │ │ │ └── OrderItem.java │ │ ├── reward │ │ │ ├── MsgEditValidatorCommissionRate.java │ │ │ ├── MsgEditValidatorCommissionRateValue.java │ │ │ ├── MsgWithdrawDelegatorAllRewards.java │ │ │ ├── MsgWithdrawDelegatorAllRewardsValue.java │ │ │ ├── MsgWithdrawDelegatorReward.java │ │ │ └── MsgWithdrawDelegatorRewardValue.java │ │ ├── slashing │ │ │ ├── MsgUnjail.java │ │ │ └── MsgUnjailValue.java │ │ ├── staking │ │ │ ├── MsgAddShares.java │ │ │ ├── MsgAddSharesValue.java │ │ │ ├── MsgBindProxy.java │ │ │ ├── MsgBindProxyValue.java │ │ │ ├── MsgCreateValidator.java │ │ │ ├── MsgCreateValidatorValue.java │ │ │ ├── MsgDeposit.java │ │ │ ├── MsgDepositValue.java │ │ │ ├── MsgDestroyValidator.java │ │ │ ├── MsgDestroyValidatorValue.java │ │ │ ├── MsgEditValidator.java │ │ │ ├── MsgEditValidatorValue.java │ │ │ ├── MsgRegProxy.java │ │ │ ├── MsgRegProxyValue.java │ │ │ ├── MsgUnbindProxy.java │ │ │ ├── MsgUnbindProxyValue.java │ │ │ ├── MsgWithdrawStaking.java │ │ │ └── MsgWithdrawStakingValue.java │ │ ├── token │ │ │ ├── MsgConfirmOwnership.java │ │ │ ├── MsgConfirmOwnershipValue.java │ │ │ ├── MsgMultiTransfer.java │ │ │ ├── MsgMultiTransferValue.java │ │ │ ├── MsgSend.java │ │ │ ├── MsgSendValue.java │ │ │ ├── MsgTokenBurn.java │ │ │ ├── MsgTokenBurnValue.java │ │ │ ├── MsgTokenIssue.java │ │ │ ├── MsgTokenIssueValue.java │ │ │ ├── MsgTokenMint.java │ │ │ ├── MsgTokenMintValue.java │ │ │ ├── MsgTokenModify.java │ │ │ ├── MsgTokenModifyValue.java │ │ │ ├── MsgTransferOwnership.java │ │ │ └── MsgTransferOwnershipValue.java │ │ ├── tx │ │ │ ├── Attribute.java │ │ │ ├── BroadcastTx.java │ │ │ ├── BroadcastValue.java │ │ │ ├── RawLog.java │ │ │ ├── Response.java │ │ │ ├── StringEvent.java │ │ │ └── UnsignedTx.java │ │ └── wasm │ │ │ ├── Fund.java │ │ │ ├── MsgClearAdmin.java │ │ │ ├── MsgClearAdminValue.java │ │ │ ├── MsgExecuteContract.java │ │ │ ├── MsgExecuteContractValue.java │ │ │ ├── MsgInstantiateContract.java │ │ │ ├── MsgInstantiateContractValue.java │ │ │ ├── MsgMigrateContract.java │ │ │ ├── MsgMigrateContractValue.java │ │ │ ├── MsgStoreCode.java │ │ │ ├── MsgStoreCodeValue.java │ │ │ ├── MsgUpdateAdmin.java │ │ │ ├── MsgUpdateAdminValue.java │ │ │ ├── WasmQuery.java │ │ │ ├── burner.wasm │ │ │ ├── cw20_base.wasm │ │ │ └── hackatom.wasm │ │ ├── sample │ │ ├── AddressConvertUtilSample.java │ │ ├── ColdSign.java │ │ ├── ColdSignTest.java │ │ ├── ContractUtilTest.java │ │ ├── Dex.java │ │ ├── EthAddress.java │ │ ├── FeesplitQuerySample.java │ │ ├── Gentx.java │ │ ├── Gentxes.java │ │ ├── Gov.java │ │ ├── IbcQuery.java │ │ ├── IbcTransfer.java │ │ ├── Staking.java │ │ ├── Token.java │ │ └── WasmQuerySample.java │ │ └── utils │ │ ├── HttpUtils.java │ │ ├── SuccessRespon.java │ │ ├── Utils.java │ │ ├── crypto │ │ ├── AddressConvertUtil.java │ │ ├── AddressUtil.java │ │ ├── Crypto.java │ │ ├── PrivateKey.java │ │ ├── encode │ │ │ ├── Bech32.java │ │ │ └── ConvertBits.java │ │ └── hash │ │ │ └── Ripemd.java │ │ ├── encoding │ │ ├── EncodeUtils.java │ │ ├── message │ │ │ ├── AminoEncode.java │ │ │ └── MessageType.java │ │ └── proto │ │ │ └── Transfer.java │ │ ├── evm │ │ └── ContractUtil.java │ │ └── exception │ │ ├── APIException.java │ │ ├── AddressFormatException.java │ │ ├── BadURLException.java │ │ ├── BuildException.java │ │ ├── ConfigurationException.java │ │ ├── ConnectivityException.java │ │ ├── CosmosException.java │ │ ├── HTTPException.java │ │ └── JSONException.java ├── proto │ └── transfer.proto └── resources │ ├── config.properties │ └── log4j.properties └── test └── java ├── com ├── cm │ └── tx │ │ └── MsgManageSysContractAddressProposalTest.java ├── feesplit │ ├── MsgFeeSplitSharesProposalTest.java │ └── MsgFeesplitParameterChangeProposalTest.java ├── ibc │ └── erc20 │ │ ├── MsgClientUpdateProposalTest.java │ │ ├── MsgContractTemplateProposalTest.java │ │ ├── MsgProxyContractRedirectProposalTest.java │ │ └── MsgTokenMappingProposalTest.java ├── okc │ ├── ibc │ │ └── HeightTest.java │ └── staking │ │ ├── MsgChangeDistributionTypeProposalTest.java │ │ ├── MsgRewardTruncatePrecisionProposalTest.java │ │ └── MsgWithdrawRewardEnabledProposalTest.java ├── okexchain │ ├── msg │ │ └── gov │ │ │ ├── MsgManageContractBytecodeProposalTest.java │ │ │ ├── MsgModifyNextBlockUpdateProposalTest.java │ │ │ └── MsgUpgradeProposalTest.java │ ├── test │ │ ├── MsgContractManageTreasuresProposalTest.java │ │ └── MsgContractMethodBlockedListProposalTest.java │ └── utils │ │ ├── UtilsTest.java │ │ └── encoding │ │ └── EncodingTest.java └── wasm │ └── TestWasmProposal.java └── crypto └── CryptoTest.java /.gitignore: -------------------------------------------------------------------------------- 1 | .name 2 | *.class 3 | target/ 4 | .idea 5 | *.json 6 | *.properties -------------------------------------------------------------------------------- /src/main/java/com/okexchain/env/EnvInstance.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.env; 2 | 3 | public class EnvInstance { 4 | 5 | static EnvBase env = new EnvBase(); 6 | 7 | public static void setEnv(String type) { 8 | } 9 | 10 | public static void setEnv(EnvBase env) { 11 | EnvInstance.env = env; 12 | } 13 | 14 | public static EnvBase getEnv() { 15 | return env; 16 | } 17 | 18 | public static EnvBase getEnvMainNet() { 19 | return env.configEnvMainNet(); 20 | } 21 | 22 | public static EnvBase getEnvTestNet() { 23 | return env.configEnvTestNet(); 24 | } 25 | 26 | public static EnvBase getEnvLocalNet(){ return env.configEnvLocalNet();} 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/ammswap/MsgCreateExchangeValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.ammswap; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import org.apache.commons.lang3.builder.ToStringBuilder; 8 | import org.apache.commons.lang3.builder.ToStringStyle; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown = true) 11 | @JsonPropertyOrder(alphabetic = true) 12 | public class MsgCreateExchangeValue { 13 | 14 | @JsonProperty("sender") 15 | @SerializedName("sender") 16 | private String sender; 17 | 18 | @JsonProperty("token0_name") 19 | @SerializedName("token0_name") 20 | private String token0Name; 21 | 22 | @JsonProperty("token1_name") 23 | @SerializedName("token1_name") 24 | private String token1Name; 25 | 26 | public void setTokenNameBefore(String token0Name) { this.token0Name = token0Name; } 27 | 28 | public void setTokenNameAfter(String token1Name) { this.token1Name = token1Name; } 29 | 30 | public void setSender(String sender) { 31 | this.sender = sender; 32 | } 33 | 34 | @Override 35 | public String toString() { 36 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 37 | .append("token0_name", token0Name) 38 | .append("token1_name", token1Name) 39 | .append("sender", sender) 40 | .toString(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/common/Block_methods.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2022 bejson.com 3 | */ 4 | package com.okexchain.msg.common; 5 | 6 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 9 | import com.google.gson.annotations.SerializedName; 10 | import lombok.Data; 11 | import org.apache.commons.lang3.builder.ToStringBuilder; 12 | import org.apache.commons.lang3.builder.ToStringStyle; 13 | 14 | @Data 15 | @JsonIgnoreProperties(ignoreUnknown = true) 16 | @JsonPropertyOrder(alphabetic = true) 17 | public class Block_methods { 18 | 19 | @JsonProperty("sign") 20 | @SerializedName("sign") 21 | private String sign; 22 | 23 | @JsonProperty("extra") 24 | @SerializedName("extra") 25 | private String extra; 26 | 27 | 28 | @Override 29 | public String toString() { 30 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 31 | .append("sign", this.sign) 32 | .append("extra", this.extra) 33 | .toString(); 34 | } 35 | } -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/common/CommissionMsg.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.common; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import org.apache.commons.lang3.builder.ToStringBuilder; 8 | import org.apache.commons.lang3.builder.ToStringStyle; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown = true) 11 | @JsonPropertyOrder(alphabetic = true) 12 | public class CommissionMsg { 13 | 14 | @JsonProperty("max_change_rate") 15 | @SerializedName("max_change_rate") 16 | private String maxChangeRate; 17 | 18 | @JsonProperty("max_rate") 19 | @SerializedName("max_rate") 20 | private String maxRate; 21 | 22 | @JsonProperty("rate") 23 | @SerializedName("rate") 24 | private String rate; 25 | 26 | public void setRate(String rate) { 27 | this.rate = rate; 28 | } 29 | 30 | public void setMaxRate(String maxRate) { 31 | this.maxRate = maxRate; 32 | } 33 | 34 | public void setMaxChangeRate(String maxChangeRate) { 35 | this.maxChangeRate = maxChangeRate; 36 | } 37 | 38 | @Override 39 | public String toString() { 40 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 41 | .append("max_change_rate", this.maxChangeRate) 42 | .append("max_rate", this.maxRate) 43 | .append("rate", this.rate) 44 | .toString(); 45 | } 46 | } 47 | 48 | 49 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/common/Contract_addresses.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.common; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import lombok.Data; 8 | import org.apache.commons.lang3.builder.ToStringBuilder; 9 | import org.apache.commons.lang3.builder.ToStringStyle; 10 | 11 | import java.util.List; 12 | @Data 13 | @JsonIgnoreProperties(ignoreUnknown = true) 14 | @JsonPropertyOrder(alphabetic = true) 15 | public class Contract_addresses { 16 | 17 | @JsonProperty("address") 18 | @SerializedName("address") 19 | private String address; 20 | 21 | 22 | @JsonProperty("block_methods") 23 | @SerializedName("block_methods") 24 | private List block_methods; 25 | 26 | 27 | @Override 28 | public String toString() { 29 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 30 | .append("address", this.address) 31 | .append("block_methods", this.block_methods) 32 | .toString(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/common/CounterParty.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.common; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import lombok.AllArgsConstructor; 8 | import lombok.Data; 9 | import lombok.NoArgsConstructor; 10 | 11 | @Data 12 | @AllArgsConstructor 13 | @NoArgsConstructor 14 | @JsonIgnoreProperties(ignoreUnknown = true) 15 | @JsonPropertyOrder(alphabetic = true) 16 | public class CounterParty { 17 | 18 | @JsonProperty("port_id") 19 | @SerializedName("port_id") 20 | private String portId; 21 | 22 | @JsonProperty("channel_id") 23 | @SerializedName("channel_id") 24 | private String channelId; 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/common/DecCoin.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.common; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import org.apache.commons.lang3.builder.ToStringBuilder; 8 | import org.apache.commons.lang3.builder.ToStringStyle; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown = true) 11 | @JsonPropertyOrder(alphabetic = true) 12 | public class DecCoin { 13 | @JsonProperty("amount") 14 | @SerializedName("amount") 15 | private String amount; 16 | 17 | @JsonProperty("denom") 18 | @SerializedName("denom") 19 | private String denom; 20 | 21 | public void setDenom(String denom) { 22 | this.denom = denom; 23 | } 24 | public void setAmount(String amount) { 25 | this.amount = amount; 26 | } 27 | 28 | @Override 29 | public String toString() { 30 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 31 | .append("denom", this.denom) 32 | .append("amount", this.amount) 33 | .toString(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/common/DenomTrace.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.common; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | @JsonIgnoreProperties(ignoreUnknown = true) 9 | @JsonPropertyOrder(alphabetic = true) 10 | public class DenomTrace { 11 | 12 | @JsonProperty("path") 13 | @SerializedName("path") 14 | private String path; 15 | 16 | @JsonProperty("base_denom") 17 | @SerializedName("base_denom") 18 | private String baseDenom; 19 | 20 | 21 | public DenomTrace() { 22 | } 23 | 24 | public DenomTrace(String path, String baseDenom) { 25 | this.path = path; 26 | this.baseDenom = baseDenom; 27 | } 28 | 29 | public String getPath() { 30 | return path; 31 | } 32 | 33 | public void setPath(String path) { 34 | this.path = path; 35 | } 36 | 37 | public String getBaseDenom() { 38 | return baseDenom; 39 | } 40 | 41 | public void setBaseDenom(String baseDenom) { 42 | this.baseDenom = baseDenom; 43 | } 44 | 45 | @Override 46 | public String toString() { 47 | return "DenomTrace{" + 48 | "path='" + path + '\'' + 49 | ", baseDenom='" + baseDenom + '\'' + 50 | '}'; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/common/Fee.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.common; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import org.apache.commons.lang3.builder.ToStringBuilder; 8 | import org.apache.commons.lang3.builder.ToStringStyle; 9 | 10 | import java.util.List; 11 | 12 | @JsonIgnoreProperties(ignoreUnknown = true) 13 | @JsonPropertyOrder(alphabetic = true) 14 | public class Fee { 15 | 16 | @JsonProperty("amount") 17 | @SerializedName("amount") 18 | private List amount; 19 | 20 | @JsonProperty("gas") 21 | @SerializedName("gas") 22 | private String gas; 23 | 24 | public List getAmount() { 25 | return amount; 26 | } 27 | 28 | public String getGas() { 29 | return gas; 30 | } 31 | 32 | public void setAmount(List amount) { 33 | this.amount = amount; 34 | } 35 | 36 | public void setGas(String gas) { 37 | this.gas = gas; 38 | } 39 | 40 | @Override 41 | public String toString() { 42 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 43 | .append("amount", amount) 44 | .append("gas", gas) 45 | .toString(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/common/Height.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.common; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 7 | import com.google.gson.annotations.SerializedName; 8 | import lombok.AllArgsConstructor; 9 | import lombok.Data; 10 | import lombok.NoArgsConstructor; 11 | import org.apache.commons.lang3.builder.ToStringBuilder; 12 | import org.apache.commons.lang3.builder.ToStringStyle; 13 | 14 | @Data 15 | @AllArgsConstructor 16 | @NoArgsConstructor 17 | @JsonIgnoreProperties(ignoreUnknown = true) 18 | @JsonPropertyOrder(alphabetic = true) 19 | public class Height { 20 | @JsonProperty("revision_number") 21 | @SerializedName("revision_number") 22 | private String revisionNumber; 23 | 24 | @JsonProperty("revision_height") 25 | @SerializedName("revision_height") 26 | private String revisionHeight; 27 | 28 | 29 | @Override 30 | public String toString() { 31 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 32 | .append("revisionNumber", revisionNumber) 33 | .append("revisionHeight", revisionHeight) 34 | .toString(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/common/InputOutput.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.common; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import org.apache.commons.lang3.builder.ToStringBuilder; 8 | import org.apache.commons.lang3.builder.ToStringStyle; 9 | 10 | import java.util.List; 11 | 12 | @JsonIgnoreProperties(ignoreUnknown = true) 13 | @JsonPropertyOrder(alphabetic = true) 14 | public class InputOutput { 15 | 16 | @JsonProperty("address") 17 | @SerializedName("address") 18 | private String address; 19 | 20 | @JsonProperty("coins") 21 | @SerializedName("coins") 22 | private List coins; 23 | 24 | public String getAddress() { 25 | return address; 26 | } 27 | 28 | public void setAddress(String address) { 29 | this.address = address; 30 | } 31 | 32 | public List getCoins() { 33 | return coins; 34 | } 35 | 36 | public void setCoins(List coins) { 37 | this.coins = coins; 38 | } 39 | 40 | @Override 41 | public String toString() { 42 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 43 | .append("address", address) 44 | .append("coins", coins) 45 | .toString(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/common/Message.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.common; 2 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 5 | import com.google.gson.annotations.SerializedName; 6 | import org.apache.commons.lang3.builder.ToStringBuilder; 7 | import org.apache.commons.lang3.builder.ToStringStyle; 8 | 9 | @JsonIgnoreProperties(ignoreUnknown = true) 10 | @JsonPropertyOrder(alphabetic = true) 11 | public class Message { 12 | 13 | public Message() { 14 | } 15 | 16 | public Message(String type, T value) { 17 | this.type = type; 18 | this.value = value; 19 | } 20 | 21 | @JsonProperty("type") 22 | @SerializedName("type") 23 | private String type; 24 | 25 | @JsonProperty("value") 26 | @SerializedName("value") 27 | private T value; 28 | 29 | public String getType() { 30 | return type; 31 | } 32 | 33 | public void setValue(T value) { 34 | this.value = value; 35 | } 36 | 37 | public void setType(String type) { 38 | this.type = type; 39 | } 40 | 41 | public T getValue() { 42 | return value; 43 | } 44 | 45 | @Override 46 | public String toString() { 47 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 48 | .append("type", type) 49 | .append("value", value) 50 | .toString(); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/common/Pagination.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.common; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | /** 9 | * response Pagination 10 | */ 11 | @JsonIgnoreProperties(ignoreUnknown = true) 12 | @JsonPropertyOrder(alphabetic = true) 13 | public class Pagination { 14 | 15 | @JsonProperty("total") 16 | @SerializedName("total") 17 | private int total; 18 | 19 | 20 | @JsonProperty("next_key") 21 | @SerializedName("next_key") 22 | private String nextKey; 23 | 24 | public Pagination() { 25 | } 26 | 27 | public Pagination(int total, String nextKey) { 28 | this.total = total; 29 | this.nextKey = nextKey; 30 | } 31 | 32 | public int getTotal() { 33 | return total; 34 | } 35 | 36 | public void setTotal(int total) { 37 | this.total = total; 38 | } 39 | 40 | public String getNextKey() { 41 | return nextKey; 42 | } 43 | 44 | public void setNextKey(String nextKey) { 45 | this.nextKey = nextKey; 46 | } 47 | 48 | @Override 49 | public String toString() { 50 | return "Pagination{" + 51 | "total=" + total + 52 | ", nextKey='" + nextKey + '\'' + 53 | '}'; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/common/Paging.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.common; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 7 | import com.google.gson.annotations.SerializedName; 8 | import lombok.AllArgsConstructor; 9 | import lombok.Data; 10 | import lombok.NoArgsConstructor; 11 | 12 | /** 13 | * request Paging parameter 14 | */ 15 | @Data 16 | @AllArgsConstructor 17 | @NoArgsConstructor 18 | @JsonIgnoreProperties(ignoreUnknown = true) 19 | @JsonPropertyOrder(alphabetic = true) 20 | public class Paging { 21 | 22 | 23 | //Request parameters 24 | @JsonProperty("key") 25 | @SerializedName("key") 26 | private String key; 27 | 28 | //Request parameters 29 | @JsonProperty("offset") 30 | @SerializedName("offset") 31 | private int offset; 32 | 33 | 34 | //Request parameters 35 | @JsonProperty("limit") 36 | @SerializedName("limit") 37 | private int limit; 38 | 39 | //Request parameters 40 | @JsonProperty("count_total") 41 | @SerializedName("count_total") 42 | private boolean countTotal; 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/common/Pair.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.common; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import com.google.gson.annotations.SerializedName; 5 | 6 | public class Pair { 7 | @JsonProperty("key") 8 | @SerializedName("key") 9 | private String key; 10 | 11 | @JsonProperty("value") 12 | @SerializedName("value") 13 | private String value; 14 | 15 | public Pair(String key, String value) { 16 | this.key = key; 17 | this.value = value; 18 | } 19 | 20 | public String getKey() { 21 | return key; 22 | } 23 | 24 | public void setKey(String key) { 25 | this.key = key; 26 | } 27 | 28 | public String getValue() { 29 | return value; 30 | } 31 | 32 | public void setValue(String value) { 33 | this.value = value; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/common/Pubkey.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.common; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import org.apache.commons.lang3.builder.ToStringBuilder; 8 | import org.apache.commons.lang3.builder.ToStringStyle; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown = true) 11 | @JsonPropertyOrder(alphabetic = true) 12 | public class Pubkey { 13 | 14 | public Pubkey() { 15 | 16 | } 17 | public Pubkey(String value) { 18 | this.type = "ethermint/PubKeyEthSecp256k1"; 19 | this.value = value; 20 | } 21 | 22 | @JsonProperty("type") 23 | @SerializedName("type") 24 | private String type; 25 | 26 | @JsonProperty("value") 27 | @SerializedName("value") 28 | private String value; 29 | 30 | public void setType(String type) { 31 | this.type = type; 32 | } 33 | 34 | public void setValue(String value) { 35 | this.value = value; 36 | } 37 | 38 | public String getType() { 39 | return type; 40 | } 41 | 42 | public String getValue() { 43 | return value; 44 | } 45 | 46 | @Override 47 | public String toString() { 48 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 49 | .append("type", type) 50 | .append("value", value) 51 | .toString(); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/common/Result.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.common; 2 | 3 | public class Result { 4 | 5 | private String msg; 6 | 7 | private boolean success; 8 | 9 | private String data; 10 | 11 | public String getMsg() { 12 | return msg; 13 | } 14 | 15 | public void setMsg(String msg) { 16 | this.msg = msg; 17 | } 18 | 19 | public boolean isSuccess() { 20 | return success; 21 | } 22 | 23 | public void setSuccess(boolean success) { 24 | this.success = success; 25 | } 26 | 27 | public String getData() { 28 | return data; 29 | } 30 | 31 | public void setData(String data) { 32 | this.data = data; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/common/Signature.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.common; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import org.apache.commons.lang3.builder.ToStringBuilder; 8 | import org.apache.commons.lang3.builder.ToStringStyle; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown = true) 11 | @JsonPropertyOrder(alphabetic = true) 12 | public class Signature { 13 | 14 | @JsonProperty("pub_key") 15 | @SerializedName("pub_key") 16 | private Pubkey pubkey; 17 | 18 | @JsonProperty("signature") 19 | @SerializedName("signature") 20 | private String signature; 21 | 22 | public Pubkey getPubkey() { 23 | return pubkey; 24 | } 25 | 26 | public String getSignature() { 27 | return signature; 28 | } 29 | 30 | public void setPubkey(Pubkey pubkey) { 31 | this.pubkey = pubkey; 32 | } 33 | 34 | public void setSignature(String signature) { 35 | this.signature = signature; 36 | } 37 | 38 | @Override 39 | public String toString() { 40 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 41 | .append("pub_key", pubkey) 42 | .append("signature", signature) 43 | .toString(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/common/TimeoutHeight.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.common; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | @JsonIgnoreProperties(ignoreUnknown = true) 9 | @JsonPropertyOrder(alphabetic = true) 10 | public class TimeoutHeight { 11 | 12 | 13 | @JsonProperty("revision_number") 14 | @SerializedName("revision_number") 15 | private String revisionNumber; 16 | 17 | @JsonProperty("revision_height") 18 | @SerializedName("revision_height") 19 | private String revisionHeight; 20 | 21 | public TimeoutHeight(String revisionNumber, String revisionHeight) { 22 | this.revisionNumber = revisionNumber; 23 | this.revisionHeight = revisionHeight; 24 | } 25 | 26 | public String getRevisionNumber() { 27 | return revisionNumber; 28 | } 29 | 30 | public void setRevisionNumber(String revisionNumber) { 31 | this.revisionNumber = revisionNumber; 32 | } 33 | 34 | public String getRevisionHeight() { 35 | return revisionHeight; 36 | } 37 | 38 | public void setRevisionHeight(String revisionHeight) { 39 | this.revisionHeight = revisionHeight; 40 | } 41 | 42 | @Override 43 | public String toString() { 44 | return "TimeoutHeight{" + 45 | "revisionNumber='" + revisionNumber + '\'' + 46 | ", revisionHeight='" + revisionHeight + '\'' + 47 | '}'; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/common/Token.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.common; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import org.apache.commons.lang3.builder.ToStringBuilder; 8 | import org.apache.commons.lang3.builder.ToStringStyle; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown = true) 11 | @JsonPropertyOrder(alphabetic = true) 12 | public class Token { 13 | 14 | @JsonProperty("amount") 15 | @SerializedName("amount") 16 | private String amount; 17 | 18 | @JsonProperty("denom") 19 | @SerializedName("denom") 20 | private String denom; 21 | 22 | public Token() { 23 | 24 | } 25 | 26 | public Token(String amount, String denom) { 27 | this.amount = amount; 28 | this.denom = denom; 29 | } 30 | 31 | public String getDenom() { 32 | return denom; 33 | } 34 | 35 | public void setDenom(String denom) { 36 | this.denom = denom; 37 | } 38 | 39 | public String getAmount() { 40 | return amount; 41 | } 42 | 43 | public void setAmount(String amount) { 44 | this.amount = amount; 45 | } 46 | 47 | @Override 48 | public String toString() { 49 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 50 | .append("amount", amount) 51 | .append("denom", denom) 52 | .toString(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/common/Treasures.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.common; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 7 | import com.google.gson.annotations.SerializedName; 8 | import lombok.Data; 9 | import org.apache.commons.lang3.builder.ToStringBuilder; 10 | import org.apache.commons.lang3.builder.ToStringStyle; 11 | 12 | @Data 13 | @JsonIgnoreProperties(ignoreUnknown = true) 14 | @JsonPropertyOrder(alphabetic = true) 15 | public class Treasures { 16 | 17 | @JsonProperty("address") 18 | @SerializedName("address") 19 | private String address; 20 | 21 | @JsonProperty("proportion") 22 | @SerializedName("proportion") 23 | private String proportion; 24 | 25 | 26 | @Override 27 | public String toString() { 28 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 29 | .append("address", this.address) 30 | .append("proportion", this.proportion) 31 | .toString(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/common/TxValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.common; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import com.google.gson.annotations.SerializedName; 5 | 6 | import java.util.List; 7 | 8 | public class TxValue { 9 | 10 | @JsonProperty("msg") 11 | @SerializedName("msg") 12 | private Message[] msgs; 13 | 14 | @JsonProperty("fee") 15 | @SerializedName("fee") 16 | private Fee fee; 17 | 18 | @JsonProperty("signatures") 19 | @SerializedName("signatures") 20 | private List signatures; 21 | 22 | @JsonProperty("memo") 23 | @SerializedName("memo") 24 | private String memo; 25 | 26 | public Message[] getMsgs() { 27 | return msgs; 28 | } 29 | 30 | public void setMsgs(Message[] msgs) { 31 | this.msgs = msgs; 32 | } 33 | 34 | public void setFee(Fee fee) { 35 | this.fee = fee; 36 | } 37 | 38 | public Fee getFee() { 39 | return fee; 40 | } 41 | 42 | public List getSignatures() { 43 | return signatures; 44 | } 45 | 46 | public String getMemo() { 47 | return memo; 48 | } 49 | 50 | public void setMemo(String memo) { 51 | this.memo = memo; 52 | } 53 | 54 | public void setSignatures(List signatures) { 55 | this.signatures = signatures; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/dex/MsgConfirmTokenPairOwnership.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.dex; 2 | 3 | import com.okexchain.msg.MsgBase; 4 | import com.okexchain.msg.common.Message; 5 | 6 | public class MsgConfirmTokenPairOwnership extends MsgBase { 7 | 8 | public MsgConfirmTokenPairOwnership () { 9 | setMsgType("okexchain/dex/MsgConfirmOwnership"); 10 | } 11 | 12 | public Message produceConfirmTokenPairOwnershipMsg (String fromAddress, String product) { 13 | 14 | MsgConfirmTokenPairOwnershipValue value = new MsgConfirmTokenPairOwnershipValue(); 15 | value.setFromAddress(fromAddress); 16 | value.setProduct(product); 17 | 18 | Message msg = new Message<>(); 19 | msg.setType(msgType); 20 | msg.setValue(value); 21 | return msg; 22 | 23 | } 24 | } -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/dex/MsgConfirmTokenPairOwnershipValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.dex; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import org.apache.commons.lang3.builder.ToStringBuilder; 8 | import org.apache.commons.lang3.builder.ToStringStyle; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown = true) 11 | @JsonPropertyOrder(alphabetic = true) 12 | public class MsgConfirmTokenPairOwnershipValue { 13 | 14 | @JsonProperty("new_owner") 15 | @SerializedName("new_owner") 16 | private String fromAddress; 17 | 18 | @JsonProperty("product") 19 | @SerializedName("product") 20 | private String product; 21 | 22 | public void setFromAddress(String fromAddress) {this.fromAddress = fromAddress;} 23 | 24 | public void setProduct(String product) {this.product = product;} 25 | 26 | @Override 27 | public String toString() { 28 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 29 | .append("new_owner", fromAddress) 30 | .append("product", product) 31 | .toString(); 32 | } 33 | } -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/dex/MsgCreateOperatorValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.dex; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import org.apache.commons.lang3.builder.ToStringBuilder; 8 | import org.apache.commons.lang3.builder.ToStringStyle; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown = true) 11 | @JsonPropertyOrder(alphabetic = true) 12 | public class MsgCreateOperatorValue { 13 | 14 | @JsonProperty("handling_fee_address") 15 | @SerializedName("handling_fee_address") 16 | private String handlingFeeAddress; 17 | 18 | @JsonProperty("owner") 19 | @SerializedName("owner") 20 | private String owner; 21 | 22 | @JsonProperty("website") 23 | @SerializedName("website") 24 | private String website; 25 | 26 | public void setHandlingFeeAddress(String handlingFeeAddress) { 27 | this.handlingFeeAddress = handlingFeeAddress; 28 | } 29 | 30 | public void setOwner(String owner) { 31 | this.owner = owner; 32 | } 33 | 34 | public void setWebsite(String website) { this.website = website; } 35 | 36 | @Override 37 | public String toString() { 38 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 39 | .append("handling_fee_address", handlingFeeAddress) 40 | .append("owner", owner) 41 | .append("website", website) 42 | .toString(); 43 | } 44 | } -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/dex/MsgDepositValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.dex; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import com.okexchain.msg.common.Token; 8 | import org.apache.commons.lang3.builder.ToStringBuilder; 9 | import org.apache.commons.lang3.builder.ToStringStyle; 10 | 11 | @JsonIgnoreProperties(ignoreUnknown = true) 12 | @JsonPropertyOrder(alphabetic = true) 13 | public class MsgDepositValue { 14 | 15 | @JsonProperty("amount") 16 | @SerializedName("amount") 17 | private Token amount; 18 | 19 | @JsonProperty("depositor") 20 | @SerializedName("depositor") 21 | private String depositor; 22 | 23 | @JsonProperty("product") 24 | @SerializedName("product") 25 | private String product; 26 | 27 | public void setAmount(Token amount) { 28 | this.amount = amount; 29 | } 30 | 31 | public void setDepositor(String depositor) { 32 | this.depositor = depositor; 33 | } 34 | 35 | public void setProduct(String product) { 36 | this.product = product; 37 | } 38 | 39 | @Override 40 | public String toString() { 41 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 42 | .append("amount", amount) 43 | .append("depositor", depositor) 44 | .append("product", product) 45 | .toString(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/dex/MsgList.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.dex; 2 | 3 | import com.okexchain.env.EnvInstance; 4 | import com.okexchain.msg.MsgBase; 5 | import com.okexchain.msg.common.Message; 6 | import com.okexchain.utils.Utils; 7 | 8 | public class MsgList extends MsgBase { 9 | 10 | public MsgList() { 11 | setMsgType("okexchain/dex/MsgList"); 12 | } 13 | 14 | public static void main(String[] args) { 15 | EnvInstance.getEnv().setChainID("okexchainevm-8"); 16 | EnvInstance.getEnv().setRestServerUrl("http://localhost:8545"); 17 | 18 | MsgList msg = new MsgList(); 19 | msg.initMnemonic(""); 20 | 21 | Message messages = msg.produceListMsg( 22 | "usdk-017", 23 | "okt", 24 | "1.00000000"); 25 | 26 | // okexchaincli tx dex list --from captain --base-asset eos-a99 --quote-asset okt -y -b block --fees 0.01okt 27 | msg.submit(messages, "0.05000000", "500000", "okexchain dex list!"); 28 | } 29 | 30 | public Message produceListMsg(String listAsset, String quoteAsset, String initPrice) { 31 | 32 | MsgListValue value = new MsgListValue(); 33 | value.setOwner(this.address); 34 | value.setListAsset(listAsset); 35 | value.setQuoteAsset(quoteAsset); 36 | value.setInitPrice(Utils.NewDecString(initPrice)); 37 | 38 | Message msg = new Message<>(); 39 | msg.setType(msgType); 40 | msg.setValue(value); 41 | return msg; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/dex/MsgTransferTokenPairOwnership.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.dex; 2 | 3 | import com.okexchain.msg.MsgBase; 4 | import com.okexchain.msg.common.Message; 5 | 6 | public class MsgTransferTokenPairOwnership extends MsgBase { 7 | 8 | public MsgTransferTokenPairOwnership () { 9 | setMsgType("okexchain/dex/MsgTransferTradingPairOwnership"); 10 | } 11 | public Message produceTransferTokenPairOwnershipMsg (String fromAddress, String toAddress, String product) { 12 | 13 | MsgTransferTokenPairOwnershipValue value = new MsgTransferTokenPairOwnershipValue(); 14 | value.setFromAddress(fromAddress); 15 | value.setProduct(product); 16 | value.setToAddress(toAddress); 17 | 18 | Message msg = new Message<>(); 19 | msg.setType(msgType); 20 | msg.setValue(value); 21 | return msg; 22 | 23 | } 24 | } -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/dex/MsgTransferTokenPairOwnershipValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.dex; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import org.apache.commons.lang3.builder.ToStringBuilder; 8 | import org.apache.commons.lang3.builder.ToStringStyle; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown = true) 11 | @JsonPropertyOrder(alphabetic = true) 12 | public class MsgTransferTokenPairOwnershipValue { 13 | 14 | @JsonProperty("from_address") 15 | @SerializedName("from_address") 16 | private String fromAddress; 17 | 18 | @JsonProperty("product") 19 | @SerializedName("product") 20 | private String product; 21 | 22 | @JsonProperty("to_address") 23 | @SerializedName("to_address") 24 | private String toAddress; 25 | 26 | public void setFromAddress(String fromAddress) {this.fromAddress = fromAddress;} 27 | 28 | public void setToAddress(String toAddress) {this.toAddress = toAddress;} 29 | 30 | public void setProduct(String product) {this.product = product;} 31 | 32 | @Override 33 | public String toString() { 34 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 35 | .append("from_address", fromAddress) 36 | .append("to_address", toAddress) 37 | .append("product", product) 38 | .toString(); 39 | } 40 | } -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/dex/MsgUpdateOperator.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.dex; 2 | 3 | import com.okexchain.msg.MsgBase; 4 | import com.okexchain.msg.common.Message; 5 | 6 | public class MsgUpdateOperator extends MsgBase { 7 | public MsgUpdateOperator() { 8 | setMsgType("okexchain/dex/UpdateOperator"); 9 | } 10 | 11 | public static void main(String[] args) { 12 | MsgUpdateOperator msg = new MsgUpdateOperator(); 13 | 14 | msg.initMnemonic(""); 15 | 16 | Message messages = msg.produceUpdateOperatorMsg( 17 | "okexchain10q0rk5qnyag7wfvvt7rtphlw589m7frsku8qc9", 18 | "https://captain.okg/operator.json"); 19 | 20 | // okexchaincli tx dex edit-operator --website http://captain.okg.com/operator.json --from captain --fees 0.02okt -b block -y 21 | msg.submit(messages, "0.01000000", "200000", "okexchain dex create operator!"); 22 | } 23 | 24 | public Message produceUpdateOperatorMsg(String handlingFeeAddress, String website) { 25 | 26 | MsgUpdateOperatorValue value = new MsgUpdateOperatorValue(); 27 | value.setOwner(this.address); 28 | value.setHandlingFeeAddress(handlingFeeAddress); 29 | value.setWebsite(website); 30 | 31 | Message msg = new Message<>(); 32 | msg.setType(msgType); 33 | msg.setValue(value); 34 | return msg; 35 | } 36 | } -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/dex/MsgUpdateOperatorValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.dex; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import org.apache.commons.lang3.builder.ToStringBuilder; 8 | import org.apache.commons.lang3.builder.ToStringStyle; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown = true) 11 | @JsonPropertyOrder(alphabetic = true) 12 | public class MsgUpdateOperatorValue { 13 | @JsonProperty("handling_fee_address") 14 | @SerializedName("handling_fee_address") 15 | private String handlingFeeAddress; 16 | 17 | @JsonProperty("owner") 18 | @SerializedName("owner") 19 | private String owner; 20 | 21 | @JsonProperty("website") 22 | @SerializedName("website") 23 | private String website; 24 | 25 | public void setHandlingFeeAddress(String handlingFeeAddress) { 26 | this.handlingFeeAddress = handlingFeeAddress; 27 | } 28 | 29 | public void setOwner(String owner) { 30 | this.owner = owner; 31 | } 32 | 33 | public void setWebsite(String website) { this.website = website; } 34 | 35 | @Override 36 | public String toString() { 37 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 38 | .append("handling_fee_address", handlingFeeAddress) 39 | .append("owner", owner) 40 | .append("website", website) 41 | .toString(); 42 | } 43 | } -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/dex/MsgWithdrawDeposit.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.dex; 2 | 3 | import com.okexchain.msg.MsgBase; 4 | import com.okexchain.msg.common.Message; 5 | import com.okexchain.msg.common.Token; 6 | import com.okexchain.utils.Utils; 7 | 8 | public class MsgWithdrawDeposit extends MsgBase { 9 | 10 | public MsgWithdrawDeposit() { setMsgType("okexchain/dex/MsgWithdraw"); } 11 | 12 | public Message produce(String denom, String amountDenom, String product) { 13 | 14 | Token amount = new Token(); 15 | amount.setDenom(denom); 16 | amount.setAmount(Utils.NewDecString(amountDenom)); 17 | 18 | MsgWithdrawDepositValue value = new MsgWithdrawDepositValue(); 19 | 20 | value.setDepositor(this.address); 21 | value.setAmount(amount); 22 | value.setProduct(product); 23 | 24 | Message msg = new Message<>(); 25 | msg.setType(msgType); 26 | msg.setValue(value); 27 | return msg; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/distribution/MsgModifyWithdrawAddress.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.distribution; 2 | 3 | import com.okexchain.msg.MsgBase; 4 | import com.okexchain.msg.common.Message; 5 | 6 | public class MsgModifyWithdrawAddress extends MsgBase { 7 | 8 | public MsgModifyWithdrawAddress() { 9 | setMsgType("okexchain/distribution/MsgModifyWithdrawAddress"); 10 | } 11 | 12 | public static void main(String[] args) { 13 | MsgModifyWithdrawAddress msg = new MsgModifyWithdrawAddress(); 14 | 15 | msg.initMnemonic(""); 16 | 17 | Message messages = msg.produceModifyWithdrawAddressMsg( 18 | "okexchain1v853tq96n9ghvyxlvqyxyj97589clccrufrkz9"); 19 | 20 | msg.submit(messages, "0.01000000", "200000", "okexchain modify withdraw address!"); 21 | } 22 | 23 | public Message produceModifyWithdrawAddressMsg(String withdrawAddress) { 24 | 25 | MsgModifyWithdrawAddressValue value = new MsgModifyWithdrawAddressValue(); 26 | value.setDelegatorAddress(this.address); 27 | value.setWithdrawAddress(withdrawAddress); 28 | 29 | Message msg = new Message<>(); 30 | msg.setType(msgType); 31 | msg.setValue(value); 32 | return msg; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/distribution/MsgModifyWithdrawAddressValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.distribution; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import org.apache.commons.lang3.builder.ToStringBuilder; 8 | import org.apache.commons.lang3.builder.ToStringStyle; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown = true) 11 | @JsonPropertyOrder(alphabetic = true) 12 | public class MsgModifyWithdrawAddressValue { 13 | 14 | @JsonProperty("delegator_address") 15 | @SerializedName("delegator_address") 16 | private String delegatorAddress; 17 | 18 | @JsonProperty("withdraw_address") 19 | @SerializedName("withdraw_address") 20 | private String withdrawAddress; 21 | 22 | public void setDelegatorAddress(String delegatorAddress) { 23 | this.delegatorAddress = delegatorAddress; 24 | } 25 | 26 | public void setWithdrawAddress(String withdrawAddress) { 27 | this.withdrawAddress = withdrawAddress; 28 | } 29 | 30 | @Override 31 | public String toString() { 32 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 33 | .append("delegator_address", delegatorAddress) 34 | .append("withdraw_address", withdrawAddress) 35 | .toString(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/distribution/MsgWithdrawReward.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.distribution; 2 | 3 | import com.okexchain.msg.MsgBase; 4 | import com.okexchain.msg.common.Message; 5 | 6 | public class MsgWithdrawReward extends MsgBase { 7 | 8 | public MsgWithdrawReward() { 9 | setMsgType("okexchain/distribution/MsgWithdrawReward"); 10 | } 11 | 12 | public static void main(String[] args) { 13 | MsgWithdrawReward msg = new MsgWithdrawReward(); 14 | 15 | msg.initMnemonic(""); 16 | 17 | Message messages = msg.produceWithdrawRewardMsg( 18 | "okexchainvaloper10q0rk5qnyag7wfvvt7rtphlw589m7frshchly8"); 19 | 20 | msg.submit(messages, "0.01000000", "200000", "okexchain withdraw reward!"); 21 | } 22 | 23 | public Message produceWithdrawRewardMsg(String withdrawAddress) { 24 | 25 | MsgWithdrawRewardValue value = new MsgWithdrawRewardValue(); 26 | value.setValidatorAddress(withdrawAddress); 27 | 28 | Message msg = new Message<>(); 29 | msg.setType(msgType); 30 | msg.setValue(value); 31 | return msg; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/distribution/MsgWithdrawRewardValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.distribution; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import org.apache.commons.lang3.builder.ToStringBuilder; 8 | import org.apache.commons.lang3.builder.ToStringStyle; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown = true) 11 | @JsonPropertyOrder(alphabetic = true) 12 | public class MsgWithdrawRewardValue { 13 | 14 | @JsonProperty("validator_address") 15 | @SerializedName("validator_address") 16 | private String validatorAddress; 17 | 18 | public void setValidatorAddress(String validatorAddress) { 19 | this.validatorAddress = validatorAddress; 20 | } 21 | 22 | @Override 23 | public String toString() { 24 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 25 | .append("validator_address", validatorAddress) 26 | .toString(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/farm/MsgClaim.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.farm; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.okexchain.env.EnvInstance; 5 | import com.okexchain.msg.MsgBase; 6 | import com.okexchain.msg.common.Message; 7 | import com.okexchain.utils.crypto.PrivateKey; 8 | 9 | public class MsgClaim extends MsgBase { 10 | 11 | public MsgClaim() { setMsgType("okexchain/farm/MsgClaim"); } 12 | 13 | public Message produceMsg(String poolName) { 14 | 15 | MsgClaimValue value = new MsgClaimValue(); 16 | 17 | value.setAddress(this.address); 18 | value.setPoolName(poolName); 19 | 20 | Message msg = new Message<>(); 21 | msg.setType(msgType); 22 | msg.setValue(value); 23 | return msg; 24 | } 25 | 26 | public static void main(String[] args) { 27 | 28 | EnvInstance.getEnv().setChainID("okexchainevm-8"); 29 | EnvInstance.getEnv().setRestServerUrl("http://localhost:8545"); 30 | 31 | PrivateKey key = new PrivateKey("EA6D97F31E4B70663594DD6AFC3E3550AAB5FDD9C44305E8F8F2003023B27FDA"); 32 | 33 | MsgClaim msg = new MsgClaim(); 34 | msg.init(key); 35 | 36 | Message messages = msg.produceMsg( 37 | "turing-pool-1" 38 | ); 39 | JSONObject res = msg.submit(messages, "0.05", "500000", "claim"); 40 | 41 | try { 42 | boolean succeed = msg.isTxSucceed(res); 43 | System.out.println("tx " + (succeed ? "succeed": "failed")); 44 | } catch (Exception e) { 45 | System.out.println(e.toString()); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/farm/MsgClaimValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.farm; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import org.apache.commons.lang3.builder.ToStringBuilder; 8 | import org.apache.commons.lang3.builder.ToStringStyle; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown = true) 11 | @JsonPropertyOrder(alphabetic = true) 12 | public class MsgClaimValue { 13 | 14 | @JsonProperty("address") 15 | @SerializedName("address") 16 | private String address; 17 | 18 | @JsonProperty("pool_name") 19 | @SerializedName("pool_name") 20 | private String poolName; 21 | 22 | public void setAddress(String address) { this.address = address; } 23 | 24 | public void setPoolName(String poolName) { this.poolName = poolName; } 25 | 26 | @Override 27 | public String toString() { 28 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 29 | .append("address", address) 30 | .append("pool_name", poolName) 31 | .toString(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/farm/MsgDestroyPoolValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.farm; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import org.apache.commons.lang3.builder.ToStringBuilder; 8 | import org.apache.commons.lang3.builder.ToStringStyle; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown = true) 11 | @JsonPropertyOrder(alphabetic = true) 12 | public class MsgDestroyPoolValue { 13 | 14 | @JsonProperty("owner") 15 | @SerializedName("owner") 16 | private String owner; 17 | 18 | @JsonProperty("pool_name") 19 | @SerializedName("pool_name") 20 | private String poolName; 21 | 22 | public void setOwner(String owner) { 23 | this.owner = owner; 24 | } 25 | 26 | public void setPoolName(String poolName) { 27 | this.poolName = poolName; 28 | } 29 | 30 | @Override 31 | public String toString() { 32 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 33 | .append("owner", owner) 34 | .append("pool_name", poolName) 35 | .toString(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/farm/MsgLockValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.farm; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import com.okexchain.msg.common.Token; 8 | import org.apache.commons.lang3.builder.ToStringBuilder; 9 | import org.apache.commons.lang3.builder.ToStringStyle; 10 | 11 | @JsonIgnoreProperties(ignoreUnknown = true) 12 | @JsonPropertyOrder(alphabetic = true) 13 | public class MsgLockValue { 14 | 15 | @JsonProperty("address") 16 | @SerializedName("address") 17 | private String address; 18 | 19 | @JsonProperty("amount") 20 | @SerializedName("amount") 21 | private Token amount; 22 | 23 | @JsonProperty("pool_name") 24 | @SerializedName("pool_name") 25 | private String poolName; 26 | 27 | public void setAddress(String address) { this.address = address; } 28 | 29 | public void setAmount(Token amount) { this.amount = amount; } 30 | 31 | public void setPoolName(String poolName) { this.poolName = poolName; } 32 | 33 | @Override 34 | public String toString() { 35 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 36 | .append("address", address) 37 | .append("amount", amount) 38 | .append("pool_name", poolName) 39 | .toString(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/farm/MsgUnlockValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.farm; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import com.okexchain.msg.common.Token; 8 | import org.apache.commons.lang3.builder.ToStringBuilder; 9 | import org.apache.commons.lang3.builder.ToStringStyle; 10 | 11 | @JsonIgnoreProperties(ignoreUnknown = true) 12 | @JsonPropertyOrder(alphabetic = true) 13 | public class MsgUnlockValue { 14 | 15 | @JsonProperty("address") 16 | @SerializedName("address") 17 | private String address; 18 | 19 | @JsonProperty("amount") 20 | @SerializedName("amount") 21 | private Token amount; 22 | 23 | @JsonProperty("pool_name") 24 | @SerializedName("pool_name") 25 | private String poolName; 26 | 27 | public void setAddress(String address) { this.address = address; } 28 | 29 | public void setAmount(Token amount) { this.amount = amount; } 30 | 31 | public void setPoolName(String poolName) { this.poolName = poolName; } 32 | 33 | @Override 34 | public String toString() { 35 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 36 | .append("address", address) 37 | .append("amount", amount) 38 | .append("pool_name", poolName) 39 | .toString(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/feesplit/MsgCancelFeeSplitValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.feesplit; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 7 | import com.google.gson.annotations.SerializedName; 8 | import com.okexchain.utils.Utils; 9 | import lombok.AllArgsConstructor; 10 | import lombok.Data; 11 | import lombok.NoArgsConstructor; 12 | import lombok.extern.slf4j.Slf4j; 13 | 14 | @Slf4j 15 | @Data 16 | @AllArgsConstructor 17 | @NoArgsConstructor 18 | @JsonIgnoreProperties(ignoreUnknown = true) 19 | @JsonPropertyOrder(alphabetic = true) 20 | public class MsgCancelFeeSplitValue { 21 | 22 | 23 | @JsonProperty("contract_address") 24 | @SerializedName("contract_address") 25 | private String contractAddress; 26 | 27 | @JsonProperty("deployer_address") 28 | @SerializedName("deployer_address") 29 | private String deployerAddress; 30 | 31 | //if contract address is ex address then convert this contract address to 0x address 32 | public void setContractAddress(String contractAddress) { 33 | try { 34 | this.contractAddress = Utils.convertContractAddress(contractAddress); 35 | } catch (Exception e) { 36 | log.error("address error: {}",e); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/feesplit/MsgUpdateFeeSplitValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.feesplit; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import com.okexchain.utils.Utils; 8 | import lombok.AllArgsConstructor; 9 | import lombok.Data; 10 | import lombok.NoArgsConstructor; 11 | import lombok.extern.slf4j.Slf4j; 12 | 13 | @Slf4j 14 | @Data 15 | @AllArgsConstructor 16 | @NoArgsConstructor 17 | @JsonIgnoreProperties(ignoreUnknown = true) 18 | @JsonPropertyOrder(alphabetic = true) 19 | public class MsgUpdateFeeSplitValue { 20 | 21 | @JsonProperty("contract_address") 22 | @SerializedName("contract_address") 23 | private String contractAddress; 24 | 25 | @JsonProperty("deployer_address") 26 | @SerializedName("deployer_address") 27 | private String deployerAddress; 28 | 29 | @JsonProperty("withdrawer_address") 30 | @SerializedName("withdrawer_address") 31 | private String withdrawerAddress; 32 | 33 | //if contract address is ex address then convert this contract address to 0x address 34 | public void setContractAddress(String contractAddress) { 35 | try { 36 | this.contractAddress = Utils.convertContractAddress(contractAddress); 37 | } catch (Exception e) { 38 | log.error("address error: {}",e); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/gov/Content.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.gov; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import org.apache.commons.lang3.builder.ToStringBuilder; 8 | import org.apache.commons.lang3.builder.ToStringStyle; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown = true) 11 | @JsonPropertyOrder(alphabetic = true) 12 | public class Content { 13 | 14 | public Content() { 15 | } 16 | 17 | public Content(String type, T value) { 18 | this.type = type; 19 | this.value = value; 20 | } 21 | 22 | @JsonProperty("type") 23 | @SerializedName("type") 24 | private String type; 25 | 26 | @JsonProperty("value") 27 | @SerializedName("value") 28 | private T value; 29 | 30 | public String getType() { 31 | return type; 32 | } 33 | 34 | public void setValue(T value) { 35 | this.value = value; 36 | } 37 | 38 | public void setType(String type) { 39 | this.type = type; 40 | } 41 | 42 | public T getValue() { 43 | return value; 44 | } 45 | 46 | @Override 47 | public String toString() { 48 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 49 | .append("type", type) 50 | .append("value", value) 51 | .toString(); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/gov/MsgChangeDistributionTypeProposal.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.gov; 2 | 3 | import com.okexchain.msg.common.Message; 4 | import com.okexchain.msg.common.Token; 5 | import com.okexchain.utils.Utils; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | public class MsgChangeDistributionTypeProposal extends MsgVote{ 11 | 12 | public MsgChangeDistributionTypeProposal(){ 13 | setMsgType("okexchain/gov/MsgSubmitProposal"); 14 | } 15 | 16 | public Message produceMsgChangeDistributionTypeProposal(MsgChangeDistributionTypeProposalValue proposalValue,String denom, String amountDeposit){ 17 | 18 | Content content=new Content(); 19 | content.setType("okexchain/distribution/ChangeDistributionTypeProposal"); 20 | content.setValue(proposalValue); 21 | 22 | // set token list 23 | List tokenList = new ArrayList<>(); 24 | Token token = new Token(); 25 | token.setDenom(denom); 26 | token.setAmount(Utils.NewDecString(amountDeposit)); 27 | tokenList.add(token); 28 | 29 | MsgSubmitProposalValue> value = new MsgSubmitProposalValue(); 30 | value.setContent(content); 31 | value.setInitialDeposit(tokenList); 32 | value.setProposer(this.address); 33 | 34 | 35 | Message>> msg = new Message<>(); 36 | msg.setValue(value); 37 | msg.setType(msgType); 38 | 39 | return msg; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/gov/MsgChangeDistributionTypeProposalValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.gov; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 7 | import com.google.gson.annotations.SerializedName; 8 | import lombok.AllArgsConstructor; 9 | import lombok.Data; 10 | import lombok.NoArgsConstructor; 11 | 12 | 13 | @Data 14 | @NoArgsConstructor 15 | @AllArgsConstructor 16 | @JsonIgnoreProperties(ignoreUnknown = true) 17 | @JsonPropertyOrder(alphabetic = true) 18 | public class MsgChangeDistributionTypeProposalValue { 19 | 20 | @JsonProperty("title") 21 | @SerializedName("title") 22 | private String title; 23 | 24 | @JsonProperty("description") 25 | @SerializedName("description") 26 | private String description; 27 | 28 | @JsonProperty("type") 29 | @SerializedName("type") 30 | private int type; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/gov/MsgContractManageTreasuresProposalValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.gov; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 7 | import com.google.gson.annotations.SerializedName; 8 | import com.okexchain.msg.common.Treasures; 9 | import lombok.Data; 10 | import org.apache.commons.lang3.builder.ToStringBuilder; 11 | import org.apache.commons.lang3.builder.ToStringStyle; 12 | 13 | import java.util.List; 14 | 15 | @Data 16 | @JsonIgnoreProperties(ignoreUnknown = true) 17 | @JsonPropertyOrder(alphabetic = true) 18 | public class MsgContractManageTreasuresProposalValue { 19 | 20 | @JsonProperty("title") 21 | @SerializedName("title") 22 | private String title; 23 | 24 | 25 | @JsonProperty("description") 26 | @SerializedName("description") 27 | private String description; 28 | 29 | @JsonProperty("treasures") 30 | @SerializedName("treasures") 31 | private List treasures; 32 | 33 | 34 | @JsonProperty("is_added") 35 | @SerializedName("is_added") 36 | private boolean isAdded; 37 | 38 | 39 | @Override 40 | public String toString() { 41 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 42 | .append("title", title) 43 | .append("description", description) 44 | .append("treasures", treasures) 45 | .append("isAdded", isAdded) 46 | .toString(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/gov/MsgContractTemplateProposalValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.gov; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 7 | import com.google.gson.annotations.SerializedName; 8 | import lombok.AllArgsConstructor; 9 | import lombok.Data; 10 | import lombok.NoArgsConstructor; 11 | import org.apache.commons.lang3.builder.ToStringBuilder; 12 | import org.apache.commons.lang3.builder.ToStringStyle; 13 | 14 | @Data 15 | @NoArgsConstructor 16 | @AllArgsConstructor 17 | @JsonIgnoreProperties(ignoreUnknown = true) 18 | @JsonPropertyOrder(alphabetic = true) 19 | public class MsgContractTemplateProposalValue { 20 | 21 | @JsonProperty("title") 22 | @SerializedName("title") 23 | private String title; 24 | 25 | 26 | @JsonProperty("description") 27 | @SerializedName("description") 28 | private String description; 29 | 30 | 31 | @JsonProperty("contract_type") 32 | @SerializedName("contract_type") 33 | private String contractType; 34 | 35 | @JsonProperty("contract") 36 | @SerializedName("contract") 37 | private String contract; 38 | 39 | 40 | public String toString() { 41 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 42 | .append("title", title) 43 | .append("description", description) 44 | .append("contractType", contractType) 45 | .append("contract", contract) 46 | .toString(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/gov/MsgManageContractBytecodeProposalValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.gov; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import lombok.AllArgsConstructor; 8 | import lombok.Data; 9 | import lombok.NoArgsConstructor; 10 | 11 | @Data 12 | @NoArgsConstructor 13 | @AllArgsConstructor 14 | @JsonIgnoreProperties(ignoreUnknown = true) 15 | @JsonPropertyOrder(alphabetic = true) 16 | public class MsgManageContractBytecodeProposalValue { 17 | 18 | @JsonProperty("title") 19 | @SerializedName("title") 20 | private String title; 21 | 22 | @JsonProperty("description") 23 | @SerializedName("description") 24 | private String description; 25 | 26 | @JsonProperty("contract") 27 | @SerializedName("contract") 28 | private String contract; 29 | 30 | @JsonProperty("substitute_contract") 31 | @SerializedName("substitute_contract") 32 | private String substituteContract; 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/gov/MsgManageSysContractAddressProposalValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.gov; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 7 | import com.google.gson.annotations.SerializedName; 8 | import com.okexchain.utils.Utils; 9 | import lombok.AllArgsConstructor; 10 | import lombok.Data; 11 | import lombok.NoArgsConstructor; 12 | import lombok.extern.slf4j.Slf4j; 13 | 14 | @Slf4j 15 | @Data 16 | @NoArgsConstructor 17 | @AllArgsConstructor 18 | @JsonIgnoreProperties(ignoreUnknown = true) 19 | @JsonPropertyOrder(alphabetic = true) 20 | public class MsgManageSysContractAddressProposalValue { 21 | 22 | 23 | @JsonProperty("title") 24 | @SerializedName("title") 25 | private String title; 26 | 27 | 28 | @JsonProperty("description") 29 | @SerializedName("description") 30 | private String description; 31 | 32 | 33 | @JsonProperty("contract_address") 34 | @SerializedName("contract_address") 35 | private String contractAddr; 36 | 37 | 38 | @JsonProperty("is_added") 39 | @SerializedName("is_added") 40 | private boolean isAdded; 41 | 42 | // if address is Hex address then convert From Hex To ExBech32 43 | public void setContractAddr(String contractAddress) { 44 | try { 45 | this.contractAddr = Utils.convertHexAddrToExBech32(contractAddress); 46 | } catch (Exception e) { 47 | log.error("address error: {}",e); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/gov/MsgModifyNextBlockUpdateProposal.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.gov; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import lombok.AllArgsConstructor; 8 | import lombok.Data; 9 | import lombok.NoArgsConstructor; 10 | 11 | public class MsgModifyNextBlockUpdateProposal extends UniversalProposal { 12 | public MsgModifyNextBlockUpdateProposal(ProposalValue proposalValue) { 13 | super("okexchain/mint/ModifyNextBlockUpdateProposal", proposalValue); 14 | } 15 | 16 | @Data 17 | @NoArgsConstructor 18 | @AllArgsConstructor 19 | @JsonIgnoreProperties(ignoreUnknown = true) 20 | @JsonPropertyOrder(alphabetic = true) 21 | public static class ProposalValue { 22 | 23 | @JsonProperty("title") 24 | @SerializedName("title") 25 | private String title; 26 | 27 | @JsonProperty("description") 28 | @SerializedName("description") 29 | private String description; 30 | 31 | @JsonProperty("block_num") 32 | @SerializedName("block_num") 33 | private String blockNum; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/gov/MsgParameterChangeProposalValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.gov; 2 | 3 | import com.alibaba.fastjson.JSONArray; 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 7 | import com.google.gson.annotations.SerializedName; 8 | import org.apache.commons.lang3.builder.ToStringBuilder; 9 | import org.apache.commons.lang3.builder.ToStringStyle; 10 | 11 | @JsonIgnoreProperties(ignoreUnknown = true) 12 | @JsonPropertyOrder(alphabetic = true) 13 | public class MsgParameterChangeProposalValue { 14 | 15 | @JsonProperty("changes") 16 | @SerializedName("changes") 17 | private JSONArray changes; 18 | 19 | @JsonProperty("description") 20 | @SerializedName("description") 21 | private String description; 22 | 23 | @JsonProperty("title") 24 | @SerializedName("title") 25 | private String title; 26 | 27 | public void setChanges(JSONArray changes) { 28 | this.changes = changes; 29 | } 30 | 31 | public void setDescription(String description) { 32 | this.description = description; 33 | } 34 | 35 | public void setTitle(String title) { 36 | this.title = title; 37 | } 38 | 39 | @Override 40 | public String toString() { 41 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 42 | .append("title", title) 43 | .append("description", description) 44 | .append("changes", changes) 45 | .toString(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/gov/MsgParameterChangeProposalWrapperValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.gov; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import org.apache.commons.lang3.builder.ToStringBuilder; 8 | import org.apache.commons.lang3.builder.ToStringStyle; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown = true) 11 | @JsonPropertyOrder(alphabetic = true) 12 | public class MsgParameterChangeProposalWrapperValue { 13 | 14 | @JsonProperty("ParameterChangeProposal") 15 | @SerializedName("ParameterChangeProposal") 16 | private MsgParameterChangeProposalValue ParameterChangeProposal; 17 | 18 | @JsonProperty("height") 19 | @SerializedName("height") 20 | private String height; 21 | 22 | public void setProposal(MsgParameterChangeProposalValue proposal) { 23 | this.ParameterChangeProposal = proposal; 24 | } 25 | 26 | public void setHeight(String height) { 27 | this.height = height; 28 | } 29 | 30 | 31 | @Override 32 | public String toString() { 33 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 34 | .append("ParameterChangeProposal", ParameterChangeProposal) 35 | .append("height", height) 36 | .toString(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/gov/MsgRewardTruncatePrecisionProposalValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.gov; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 7 | import com.google.gson.annotations.SerializedName; 8 | import lombok.AllArgsConstructor; 9 | import lombok.Data; 10 | import lombok.NoArgsConstructor; 11 | 12 | 13 | @Data 14 | @NoArgsConstructor 15 | @AllArgsConstructor 16 | @JsonIgnoreProperties(ignoreUnknown = true) 17 | @JsonPropertyOrder(alphabetic = true) 18 | public class MsgRewardTruncatePrecisionProposalValue { 19 | 20 | 21 | @JsonProperty("title") 22 | @SerializedName("title") 23 | private String title; 24 | 25 | @JsonProperty("description") 26 | @SerializedName("description") 27 | private String description; 28 | 29 | @JsonProperty("precision") 30 | @SerializedName("precision") 31 | private String precision; 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/gov/MsgTokenMappingProposalValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.gov; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 7 | import com.google.gson.annotations.SerializedName; 8 | import lombok.AllArgsConstructor; 9 | import lombok.Data; 10 | import lombok.NoArgsConstructor; 11 | import org.apache.commons.lang3.builder.ToStringBuilder; 12 | import org.apache.commons.lang3.builder.ToStringStyle; 13 | 14 | @Data 15 | @NoArgsConstructor 16 | @AllArgsConstructor 17 | @JsonIgnoreProperties(ignoreUnknown = true) 18 | @JsonPropertyOrder(alphabetic = true) 19 | public class MsgTokenMappingProposalValue { 20 | 21 | @JsonProperty("title") 22 | @SerializedName("title") 23 | private String title; 24 | 25 | @JsonProperty("description") 26 | @SerializedName("description") 27 | private String description; 28 | 29 | @JsonProperty("denom") 30 | @SerializedName("denom") 31 | private String denom; 32 | 33 | @JsonProperty("contract") 34 | @SerializedName("contract") 35 | private String contract; 36 | 37 | 38 | public String toString() { 39 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 40 | .append("title", title) 41 | .append("description", description) 42 | .append("denom", denom) 43 | .append("contract",contract) 44 | .toString(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/gov/MsgVote.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.gov; 2 | 3 | import com.okexchain.msg.MsgBase; 4 | import com.okexchain.msg.common.Message; 5 | 6 | public class MsgVote extends MsgBase { 7 | 8 | public MsgVote() { 9 | setMsgType("okexchain/gov/MsgVote"); 10 | } 11 | 12 | public static void main(String[] args) { 13 | MsgVote msg = new MsgVote(); 14 | 15 | msg.initMnemonic(""); 16 | 17 | Message messages = msg.produceVoteMsg( 18 | "2", 19 | "Yes"); 20 | 21 | msg.submit(messages, "0.01000000", "200000", "okexchain gov vot!"); 22 | } 23 | 24 | public Message produceVoteMsg(String ProposalID, String option) { 25 | 26 | MsgVoteValue value = new MsgVoteValue(); 27 | value.setProposalID(ProposalID); 28 | value.setVoters(this.address); 29 | value.setOption(option); 30 | 31 | Message msg = new Message<>(); 32 | msg.setType(msgType); 33 | msg.setValue(value); 34 | return msg; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/gov/MsgVoteValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.gov; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import org.apache.commons.lang3.builder.ToStringBuilder; 8 | import org.apache.commons.lang3.builder.ToStringStyle; 9 | 10 | 11 | @JsonIgnoreProperties(ignoreUnknown = true) 12 | @JsonPropertyOrder(alphabetic = true) 13 | public class MsgVoteValue { 14 | 15 | @JsonProperty("option") 16 | @SerializedName("option") 17 | private String option; 18 | 19 | @JsonProperty("proposal_id") 20 | @SerializedName("proposal_id") 21 | private String proposalID; 22 | 23 | @JsonProperty("voter") 24 | @SerializedName("voter") 25 | private String voter; 26 | 27 | public void setOption(String option) { 28 | this.option = option; 29 | } 30 | 31 | public void setProposalID(String proposalID) { 32 | this.proposalID = proposalID; 33 | } 34 | 35 | public void setVoters(String voter) { 36 | this.voter = voter; 37 | } 38 | 39 | @Override 40 | public String toString() { 41 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 42 | .append("proposal_id", proposalID) 43 | .append("voter", voter) 44 | .append("option", option) 45 | .toString(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/gov/MsgWithdrawRewardEnabledProposal.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.gov; 2 | 3 | import com.okexchain.msg.common.Message; 4 | import com.okexchain.msg.common.Token; 5 | import com.okexchain.utils.Utils; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | public class MsgWithdrawRewardEnabledProposal extends MsgVote { 11 | 12 | public MsgWithdrawRewardEnabledProposal(){ 13 | setMsgType("okexchain/gov/MsgSubmitProposal"); 14 | } 15 | 16 | 17 | public Message produceMsgWithdrawRewardEnabledProposal(MsgWithdrawRewardEnabledProposalValue proposalValue, String denom, String amountDeposit){ 18 | Content content=new Content(); 19 | content.setType("okexchain/distribution/WithdrawRewardEnabledProposal"); 20 | content.setValue(proposalValue); 21 | 22 | // set token list 23 | List tokenList = new ArrayList<>(); 24 | Token token = new Token(); 25 | token.setDenom(denom); 26 | token.setAmount(Utils.NewDecString(amountDeposit)); 27 | tokenList.add(token); 28 | 29 | MsgSubmitProposalValue> value=new MsgSubmitProposalValue(); 30 | value.setContent(content); 31 | value.setInitialDeposit(tokenList); 32 | value.setProposer(this.address); 33 | 34 | 35 | Message>> msg=new Message<>(); 36 | msg.setValue(value); 37 | msg.setType(msgType); 38 | 39 | return msg; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/gov/MsgWithdrawRewardEnabledProposalValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.gov; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 7 | import com.google.gson.annotations.SerializedName; 8 | import lombok.AllArgsConstructor; 9 | import lombok.Data; 10 | import lombok.NoArgsConstructor; 11 | 12 | 13 | 14 | @Data 15 | @NoArgsConstructor 16 | @AllArgsConstructor 17 | @JsonIgnoreProperties(ignoreUnknown = true) 18 | @JsonPropertyOrder(alphabetic = true) 19 | public class MsgWithdrawRewardEnabledProposalValue { 20 | 21 | @JsonProperty("title") 22 | @SerializedName("title") 23 | private String title; 24 | 25 | 26 | @JsonProperty("description") 27 | @SerializedName("description") 28 | private String description; 29 | 30 | @JsonProperty("enabled") 31 | @SerializedName("enabled") 32 | private boolean enabled; 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/gov/UniversalProposal.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.gov; 2 | 3 | import com.okexchain.msg.MsgBase; 4 | import com.okexchain.msg.common.Message; 5 | import com.okexchain.msg.common.Token; 6 | import com.okexchain.utils.Utils; 7 | 8 | import java.util.ArrayList; 9 | import java.util.List; 10 | 11 | public class UniversalProposal extends MsgBase { 12 | private String proposalType; 13 | private T proposalValue; 14 | 15 | public UniversalProposal(String proposalType, T proposalValue) { 16 | this.proposalType = proposalType; 17 | this.proposalValue = proposalValue; 18 | this.setMsgType("okexchain/gov/MsgSubmitProposal"); 19 | } 20 | 21 | public Message buildMessage(String denom, String amount) { 22 | // build content 23 | Content content = new Content(); 24 | content.setType(this.proposalType); 25 | content.setValue(this.proposalValue); 26 | 27 | // set token list 28 | List tokenList = new ArrayList<>(); 29 | Token token = new Token(); 30 | token.setDenom(denom); 31 | token.setAmount(Utils.NewDecString(amount)); 32 | tokenList.add(token); 33 | 34 | MsgSubmitProposalValue> value = new MsgSubmitProposalValue(); 35 | value.setContent(content); 36 | value.setInitialDeposit(tokenList); 37 | value.setProposer(this.address); 38 | 39 | 40 | Message>> msg = new Message<>(); 41 | msg.setValue(value); 42 | msg.setType(msgType); 43 | 44 | return msg; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/gov/feesplit/MsgFeeSplitSharesProposalValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.gov.feesplit; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 7 | import com.google.gson.annotations.SerializedName; 8 | import lombok.AllArgsConstructor; 9 | import lombok.Data; 10 | import lombok.NoArgsConstructor; 11 | 12 | import java.util.List; 13 | 14 | @Data 15 | @NoArgsConstructor 16 | @AllArgsConstructor 17 | @JsonIgnoreProperties(ignoreUnknown = true) 18 | @JsonPropertyOrder(alphabetic = true) 19 | public class MsgFeeSplitSharesProposalValue { 20 | 21 | 22 | 23 | @JsonProperty("title") 24 | @SerializedName("title") 25 | private String title; 26 | 27 | 28 | @JsonProperty("description") 29 | @SerializedName("description") 30 | private String description; 31 | 32 | 33 | @JsonProperty("shares") 34 | @SerializedName("shares") 35 | private List shareList; 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/gov/feesplit/Share.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.gov.feesplit; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 7 | import com.google.gson.annotations.SerializedName; 8 | import com.okexchain.utils.Utils; 9 | import lombok.AllArgsConstructor; 10 | import lombok.Data; 11 | import lombok.NoArgsConstructor; 12 | 13 | @Data 14 | @NoArgsConstructor 15 | @AllArgsConstructor 16 | @JsonIgnoreProperties(ignoreUnknown = true) 17 | @JsonPropertyOrder(alphabetic = true) 18 | public class Share { 19 | 20 | @JsonProperty("contract_addr") 21 | @SerializedName("contract_addr") 22 | private String contractAddr; 23 | 24 | @JsonProperty("share") 25 | @SerializedName("share") 26 | private String share; 27 | 28 | //overwrite set method 29 | public void setShare(double share) { 30 | this.share = Utils.NewDecString(String.valueOf(share)); 31 | } 32 | } 33 | 34 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/gov/wasm/BlockedMethod.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.gov.wasm; 2 | 3 | 4 | import com.alibaba.fastjson.annotation.JSONField; 5 | import com.fasterxml.jackson.annotation.*; 6 | import com.google.gson.annotations.SerializedName; 7 | import lombok.AllArgsConstructor; 8 | import lombok.Data; 9 | import lombok.NoArgsConstructor; 10 | import java.util.List; 11 | 12 | @Data 13 | @NoArgsConstructor 14 | @AllArgsConstructor 15 | @JsonIgnoreProperties(ignoreUnknown = true) 16 | @JsonPropertyOrder(alphabetic = true) 17 | public class BlockedMethod { 18 | 19 | 20 | @JsonProperty("contractAddr") 21 | @SerializedName("contractAddr") 22 | private String contractAddr; 23 | 24 | @JsonProperty("methods") 25 | @SerializedName("methods") 26 | private List methods; 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/gov/wasm/Method.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.gov.wasm; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonInclude; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 8 | import com.google.gson.annotations.SerializedName; 9 | import lombok.AllArgsConstructor; 10 | import lombok.Data; 11 | import lombok.NoArgsConstructor; 12 | 13 | @Data 14 | @NoArgsConstructor 15 | @AllArgsConstructor 16 | @JsonIgnoreProperties(ignoreUnknown = true) 17 | @JsonPropertyOrder(alphabetic = true) 18 | public class Method { 19 | 20 | 21 | @JsonProperty("name") 22 | @SerializedName("name") 23 | private String name; 24 | 25 | @JsonProperty("extra") 26 | @SerializedName("extra") 27 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 28 | private String extra; 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/gov/wasm/MsgClearAdminProposal.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.gov.wasm; 2 | 3 | import com.okexchain.msg.MsgBase; 4 | import com.okexchain.msg.common.Message; 5 | import com.okexchain.msg.common.Token; 6 | import com.okexchain.msg.gov.Content; 7 | import com.okexchain.msg.gov.MsgSubmitProposalValue; 8 | import com.okexchain.utils.Utils; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | public class MsgClearAdminProposal extends MsgBase { 14 | 15 | public MsgClearAdminProposal(){ 16 | setMsgType("okexchain/gov/MsgSubmitProposal"); 17 | } 18 | 19 | public Message produceMsgClearAdminProposal(MsgClearAdminProposalValue proposalValue,String denom, String amountDeposit){ 20 | Content content=new Content<>(); 21 | content.setType("wasm/ClearAdminProposal"); 22 | content.setValue(proposalValue); 23 | 24 | // set token list 25 | List tokenList = new ArrayList<>(); 26 | Token token = new Token(); 27 | token.setDenom(denom); 28 | token.setAmount(Utils.NewDecString(amountDeposit)); 29 | tokenList.add(token); 30 | 31 | MsgSubmitProposalValue> value=new MsgSubmitProposalValue<>(); 32 | value.setProposer(this.address); 33 | value.setInitialDeposit(tokenList); 34 | value.setContent(content); 35 | 36 | Message>> msg=new Message<>(); 37 | msg.setValue(value); 38 | msg.setType(msgType); 39 | 40 | return msg; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/gov/wasm/MsgClearAdminProposalValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.gov.wasm; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 7 | import com.google.gson.annotations.SerializedName; 8 | import lombok.Data; 9 | import lombok.NoArgsConstructor; 10 | 11 | @Data 12 | @NoArgsConstructor 13 | @JsonIgnoreProperties(ignoreUnknown = true) 14 | @JsonPropertyOrder(alphabetic = true) 15 | public class MsgClearAdminProposalValue { 16 | 17 | @JsonProperty("title") 18 | @SerializedName("title") 19 | private String title; 20 | 21 | 22 | @JsonProperty("description") 23 | @SerializedName("description") 24 | private String description; 25 | 26 | 27 | @JsonProperty("contract") 28 | @SerializedName("contract") 29 | private String contract; 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/gov/wasm/MsgExtraProposal.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.gov.wasm; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import com.okexchain.msg.gov.UniversalProposal; 8 | import lombok.AllArgsConstructor; 9 | import lombok.Data; 10 | import lombok.NoArgsConstructor; 11 | 12 | public class MsgExtraProposal extends UniversalProposal { 13 | 14 | public MsgExtraProposal(ProposalValue proposalValue) { 15 | super("wasm/ExtraProposal", proposalValue); 16 | } 17 | 18 | @Data 19 | @NoArgsConstructor 20 | @AllArgsConstructor 21 | @JsonIgnoreProperties(ignoreUnknown = true) 22 | @JsonPropertyOrder(alphabetic = true) 23 | public static class ProposalValue { 24 | 25 | @JsonProperty("title") 26 | @SerializedName("title") 27 | private String title; 28 | 29 | @JsonProperty("description") 30 | @SerializedName("description") 31 | private String description; 32 | 33 | @JsonProperty("action") 34 | @SerializedName("action") 35 | private String action; 36 | 37 | @JsonProperty("extra") 38 | @SerializedName("extra") 39 | private String extra; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/gov/wasm/MsgMigrateContractProposalValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.gov.wasm; 2 | 3 | 4 | import com.alibaba.fastjson.JSON; 5 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 8 | import com.google.gson.annotations.SerializedName; 9 | import com.okexchain.utils.Utils; 10 | import lombok.AllArgsConstructor; 11 | import lombok.Data; 12 | import lombok.NoArgsConstructor; 13 | 14 | @Data 15 | @NoArgsConstructor 16 | @JsonIgnoreProperties(ignoreUnknown = true) 17 | @JsonPropertyOrder(alphabetic = true) 18 | public class MsgMigrateContractProposalValue { 19 | 20 | 21 | @JsonProperty("title") 22 | @SerializedName("title") 23 | private String title; 24 | 25 | 26 | @JsonProperty("description") 27 | @SerializedName("description") 28 | private String description; 29 | 30 | 31 | @JsonProperty("contract") 32 | @SerializedName("contract") 33 | private String contract; 34 | 35 | 36 | @JsonProperty("code_id") 37 | @SerializedName("code_id") 38 | private String codeId; 39 | 40 | 41 | @JsonProperty("msg") 42 | @SerializedName("msg") 43 | private JSON msg; 44 | 45 | 46 | public void setCodeId(int codeId) { 47 | this.codeId = String.valueOf(codeId); 48 | } 49 | 50 | public void setMsg(String msgJson) throws Exception { 51 | this.msg = Utils.getSortJson(msgJson); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/gov/wasm/MsgPinCodesProposal.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.gov.wasm; 2 | 3 | import com.okexchain.msg.MsgBase; 4 | import com.okexchain.msg.common.Message; 5 | import com.okexchain.msg.common.Token; 6 | import com.okexchain.msg.gov.Content; 7 | import com.okexchain.msg.gov.MsgSubmitProposalValue; 8 | import com.okexchain.utils.Utils; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | public class MsgPinCodesProposal extends MsgBase { 14 | 15 | public MsgPinCodesProposal() { 16 | setMsgType("okexchain/gov/MsgSubmitProposal"); 17 | } 18 | 19 | public Message produceMsgPinCodesProposal(MsgPinCodesProposalValue proposalValue, String denom, String amountDeposit) { 20 | Content content = new Content<>(); 21 | content.setType("wasm/PinCodesProposal"); 22 | content.setValue(proposalValue); 23 | 24 | // set token list 25 | List tokenList = new ArrayList<>(); 26 | Token token = new Token(); 27 | token.setDenom(denom); 28 | token.setAmount(Utils.NewDecString(amountDeposit)); 29 | tokenList.add(token); 30 | 31 | MsgSubmitProposalValue> value=new MsgSubmitProposalValue<>(); 32 | value.setContent(content); 33 | value.setProposer(this.address); 34 | value.setInitialDeposit(tokenList); 35 | 36 | Message>> msg=new Message<>(); 37 | msg.setType(msgType); 38 | msg.setValue(value); 39 | 40 | return msg; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/gov/wasm/MsgPinCodesProposalValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.gov.wasm; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 7 | import com.google.gson.annotations.SerializedName; 8 | import com.okexchain.msg.ibc.transfer.ParamsResponse; 9 | import lombok.AllArgsConstructor; 10 | import lombok.Data; 11 | import lombok.NoArgsConstructor; 12 | 13 | import java.util.Arrays; 14 | 15 | @Data 16 | @NoArgsConstructor 17 | @AllArgsConstructor 18 | @JsonIgnoreProperties(ignoreUnknown = true) 19 | @JsonPropertyOrder(alphabetic = true) 20 | public class MsgPinCodesProposalValue { 21 | 22 | 23 | @JsonProperty("title") 24 | @SerializedName("title") 25 | private String title; 26 | 27 | @JsonProperty("description") 28 | @SerializedName("description") 29 | private String description; 30 | 31 | @JsonProperty("code_ids") 32 | @SerializedName("code_ids") 33 | private String[] codeIds; 34 | 35 | 36 | public void setCodeIds(int[] codeIds) throws Exception { 37 | if (codeIds.length > 0) { 38 | this.codeIds = Arrays.stream(codeIds) 39 | .mapToObj(String::valueOf) 40 | .toArray(String[]::new); 41 | } else { 42 | throw new Exception("The codeIds array must be greater than 0"); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/gov/wasm/MsgUnpinCodesProposal.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.gov.wasm; 2 | 3 | import com.okexchain.msg.MsgBase; 4 | import com.okexchain.msg.common.Message; 5 | import com.okexchain.msg.common.Token; 6 | import com.okexchain.msg.gov.Content; 7 | import com.okexchain.msg.gov.MsgSubmitProposalValue; 8 | import com.okexchain.utils.Utils; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | public class MsgUnpinCodesProposal extends MsgBase { 14 | public MsgUnpinCodesProposal() { 15 | setMsgType("okexchain/gov/MsgSubmitProposal"); 16 | } 17 | 18 | public Message produceMsgUnpinCodesProposal(MsgUnpinCodesProposalValue proposalValue, String denom, String amountDeposit) { 19 | Content content = new Content<>(); 20 | content.setType("wasm/UnpinCodesProposal"); 21 | content.setValue(proposalValue); 22 | 23 | // set token list 24 | List tokenList = new ArrayList<>(); 25 | Token token = new Token(); 26 | token.setDenom(denom); 27 | token.setAmount(Utils.NewDecString(amountDeposit)); 28 | tokenList.add(token); 29 | 30 | MsgSubmitProposalValue> value=new MsgSubmitProposalValue<>(); 31 | value.setContent(content); 32 | value.setProposer(this.address); 33 | value.setInitialDeposit(tokenList); 34 | 35 | Message>> msg=new Message<>(); 36 | msg.setType(msgType); 37 | msg.setValue(value); 38 | 39 | return msg; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/gov/wasm/MsgUnpinCodesProposalValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.gov.wasm; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import lombok.AllArgsConstructor; 8 | import lombok.Data; 9 | import lombok.NoArgsConstructor; 10 | 11 | import java.util.Arrays; 12 | 13 | @Data 14 | @NoArgsConstructor 15 | @AllArgsConstructor 16 | @JsonIgnoreProperties(ignoreUnknown = true) 17 | @JsonPropertyOrder(alphabetic = true) 18 | public class MsgUnpinCodesProposalValue { 19 | 20 | @JsonProperty("title") 21 | @SerializedName("title") 22 | private String title; 23 | 24 | @JsonProperty("description") 25 | @SerializedName("description") 26 | private String description; 27 | 28 | @JsonProperty("code_ids") 29 | @SerializedName("code_ids") 30 | private String[] codeIds; 31 | 32 | 33 | public void setCodeIds(int[] codeIds) throws Exception { 34 | if (codeIds.length > 0) { 35 | this.codeIds = Arrays.stream(codeIds) 36 | .mapToObj(String::valueOf) 37 | .toArray(String[]::new); 38 | } else { 39 | throw new Exception("The codeIds array must be greater than 0"); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/gov/wasm/MsgUpdateAdminProposalValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.gov.wasm; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 7 | import com.google.gson.annotations.SerializedName; 8 | import lombok.AllArgsConstructor; 9 | import lombok.Data; 10 | import lombok.NoArgsConstructor; 11 | 12 | @Data 13 | @NoArgsConstructor 14 | @AllArgsConstructor 15 | @JsonIgnoreProperties(ignoreUnknown = true) 16 | @JsonPropertyOrder(alphabetic = true) 17 | public class MsgUpdateAdminProposalValue { 18 | 19 | 20 | @JsonProperty("title") 21 | @SerializedName("title") 22 | private String title; 23 | 24 | 25 | @JsonProperty("description") 26 | @SerializedName("description") 27 | private String description; 28 | 29 | 30 | @JsonProperty("new_admin") 31 | @SerializedName("new_admin") 32 | private String newAdmin; 33 | 34 | 35 | @JsonProperty("contract") 36 | @SerializedName("contract") 37 | private String contract; 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/gov/wasm/MsgUpdateDeploymentWhitelistProposalValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.gov.wasm; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import lombok.AllArgsConstructor; 8 | import lombok.Data; 9 | import lombok.NoArgsConstructor; 10 | 11 | @Data 12 | @NoArgsConstructor 13 | @AllArgsConstructor 14 | @JsonIgnoreProperties(ignoreUnknown = true) 15 | @JsonPropertyOrder(alphabetic = true) 16 | public class MsgUpdateDeploymentWhitelistProposalValue { 17 | 18 | @JsonProperty("title") 19 | @SerializedName("title") 20 | private String title; 21 | 22 | 23 | @JsonProperty("description") 24 | @SerializedName("description") 25 | private String description; 26 | 27 | @JsonProperty("distributorAddrs") 28 | @SerializedName("distributorAddrs") 29 | private String[] distributorAddrs; 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/gov/wasm/MsgUpdateWASMContractMethodBlockedListProposalValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.gov.wasm; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonInclude; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 8 | import com.google.gson.annotations.SerializedName; 9 | import lombok.AllArgsConstructor; 10 | import lombok.Data; 11 | import lombok.NoArgsConstructor; 12 | 13 | @Data 14 | @NoArgsConstructor 15 | @AllArgsConstructor 16 | @JsonIgnoreProperties(ignoreUnknown = true) 17 | @JsonPropertyOrder(alphabetic = true) 18 | public class MsgUpdateWASMContractMethodBlockedListProposalValue { 19 | 20 | 21 | @JsonProperty("title") 22 | @SerializedName("title") 23 | private String title; 24 | 25 | @JsonProperty("description") 26 | @SerializedName("description") 27 | private String description; 28 | 29 | @JsonProperty("blockedMethods") 30 | @SerializedName("blockedMethods") 31 | private BlockedMethod blockedMethod; 32 | 33 | @JsonProperty("isDelete") 34 | @SerializedName("isDelete") 35 | @JsonInclude(JsonInclude.Include.NON_DEFAULT) 36 | private boolean isDelete; 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/ibc/HeaderQuery.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.ibc; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.okexchain.env.EnvBase; 5 | import com.okexchain.env.EnvInstance; 6 | import com.okexchain.utils.HttpUtils; 7 | import lombok.extern.slf4j.Slf4j; 8 | 9 | 10 | @Slf4j 11 | public class HeaderQuery { 12 | 13 | public static JSONObject queryHeader(String height){ 14 | String data="{\"jsonrpc\":\"2.0\",\"id\":0,\"method\":\"commit\",\"params\":{\"height\":\""+height+"\"}}"; 15 | String result=""; 16 | try { 17 | result=HttpUtils.sendPostDataByJson(EnvInstance.getEnv().GetRestServerUrl(),data,""); 18 | System.out.println(EnvInstance.getEnv().GetRestServerUrl()); 19 | }catch (Exception e){ 20 | log.error("Error:{}",e.toString()); 21 | } 22 | return JSONObject.parseObject(result); 23 | } 24 | 25 | public static void main(String []args){ 26 | EnvBase env = EnvInstance.getEnv(); 27 | env.setRestServerUrl("http://127.0.0.1:36657"); 28 | JSONObject json= HeaderQuery.queryHeader("100"); 29 | System.out.println(json); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/ibc/TransferMsg.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.ibc; 2 | 3 | import com.okexchain.msg.MsgBase; 4 | import com.okexchain.msg.common.Message; 5 | import com.okexchain.msg.common.TimeoutHeight; 6 | import com.okexchain.msg.common.Token; 7 | 8 | public class TransferMsg extends MsgBase { 9 | 10 | 11 | public TransferMsg() { 12 | setMsgType("cosmos-sdk/MsgTransfer"); 13 | } 14 | 15 | /** 16 | * ibc transfer msg 17 | * @param sourceChannel source channel 18 | * @param amount amount uint is wei 19 | * @param receiver address of receiver 20 | * @param timeoutHeight timeout Height 21 | * @return Message 22 | */ 23 | public Message produceMsg(String sourceChannel, String amount,String receiver, TimeoutHeight timeoutHeight) { 24 | 25 | TransferMsgValue transferMsgValue = new TransferMsgValue(); 26 | transferMsgValue.setSourceChannel(sourceChannel); 27 | transferMsgValue.setSourcePort("transfer"); 28 | transferMsgValue.setSender(this.address); 29 | transferMsgValue.setReceiver(receiver); 30 | transferMsgValue.setTimeoutHeight(timeoutHeight); 31 | transferMsgValue.setToken(new Token(amount,"wei")); 32 | 33 | Message msg = new Message<>(); 34 | msg.setType(msgType); 35 | msg.setValue(transferMsgValue); 36 | 37 | return msg; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/ibc/channel/Channel.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.ibc.channel; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 7 | import com.google.gson.annotations.SerializedName; 8 | import com.okexchain.msg.common.CounterParty; 9 | import lombok.AllArgsConstructor; 10 | import lombok.Data; 11 | import lombok.NoArgsConstructor; 12 | 13 | import java.util.List; 14 | 15 | @Data 16 | @AllArgsConstructor 17 | @NoArgsConstructor 18 | @JsonIgnoreProperties(ignoreUnknown = true) 19 | @JsonPropertyOrder(alphabetic = true) 20 | public class Channel { 21 | @JsonProperty("state") 22 | @SerializedName("state") 23 | private String state; 24 | 25 | @JsonProperty("ordering") 26 | @SerializedName("ordering") 27 | private String ordering; 28 | 29 | @JsonProperty("counterparty") 30 | @SerializedName("counterparty") 31 | private CounterParty counterParty; 32 | 33 | @JsonProperty("connection_hops") 34 | @SerializedName("connection_hops") 35 | private List connectionHops; 36 | 37 | @JsonProperty("version") 38 | @SerializedName("version") 39 | private String version; 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/ibc/channel/ChannelResponse.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.ibc.channel; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 7 | import com.google.gson.annotations.SerializedName; 8 | import com.okexchain.msg.common.Height; 9 | import lombok.AllArgsConstructor; 10 | import lombok.Data; 11 | import lombok.NoArgsConstructor; 12 | 13 | @Data 14 | @AllArgsConstructor 15 | @NoArgsConstructor 16 | @JsonIgnoreProperties(ignoreUnknown = true) 17 | @JsonPropertyOrder(alphabetic = true) 18 | public class ChannelResponse { 19 | 20 | @JsonProperty("channel") 21 | @SerializedName("channel") 22 | private Channel channel; 23 | 24 | @JsonProperty("proof") 25 | @SerializedName("proof") 26 | private String proof; 27 | 28 | @JsonProperty("proof_height") 29 | @SerializedName("proof_height") 30 | private Height proofHeight; 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/ibc/channel/Channels.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.ibc.channel; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 7 | import com.google.gson.annotations.SerializedName; 8 | import com.okexchain.msg.common.CounterParty; 9 | import lombok.AllArgsConstructor; 10 | import lombok.Data; 11 | import lombok.NoArgsConstructor; 12 | 13 | import java.util.List; 14 | 15 | @Data 16 | @AllArgsConstructor 17 | @NoArgsConstructor 18 | @JsonIgnoreProperties(ignoreUnknown = true) 19 | @JsonPropertyOrder(alphabetic = true) 20 | public class Channels { 21 | 22 | @JsonProperty("state") 23 | @SerializedName("state") 24 | private String state; 25 | 26 | @JsonProperty("ordering") 27 | @SerializedName("ordering") 28 | private String ordering; 29 | 30 | @JsonProperty("counterparty") 31 | @SerializedName("counterparty") 32 | private CounterParty counterParty; 33 | 34 | @JsonProperty("connection_hops") 35 | @SerializedName("connection_hops") 36 | private List connectionHops; 37 | 38 | @JsonProperty("version") 39 | @SerializedName("version") 40 | private String version; 41 | 42 | @JsonProperty("port_id") 43 | @SerializedName("port_id") 44 | private String portId; 45 | 46 | @JsonProperty("channel_id") 47 | @SerializedName("channel_id") 48 | private String channelId; 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/ibc/channel/ChannelsResponse.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.ibc.channel; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 7 | import com.google.gson.annotations.SerializedName; 8 | import com.okexchain.msg.common.Height; 9 | import com.okexchain.msg.common.Pagination; 10 | import lombok.AllArgsConstructor; 11 | import lombok.Data; 12 | import lombok.NoArgsConstructor; 13 | 14 | import java.util.List; 15 | 16 | @Data 17 | @AllArgsConstructor 18 | @NoArgsConstructor 19 | @JsonIgnoreProperties(ignoreUnknown = true) 20 | @JsonPropertyOrder(alphabetic = true) 21 | public class ChannelsResponse { 22 | 23 | @JsonProperty("channels") 24 | @SerializedName("channels") 25 | private List channels; 26 | 27 | @JsonProperty("pagination") 28 | @SerializedName("pagination") 29 | private Pagination pagination; 30 | 31 | @JsonProperty("height") 32 | @SerializedName("height") 33 | private Height height; 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/ibc/channel/Commitment.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.ibc.channel; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import lombok.AllArgsConstructor; 8 | import lombok.Data; 9 | import lombok.NoArgsConstructor; 10 | import org.apache.commons.lang3.builder.ToStringBuilder; 11 | import org.apache.commons.lang3.builder.ToStringStyle; 12 | 13 | 14 | @Data 15 | @AllArgsConstructor 16 | @NoArgsConstructor 17 | @JsonIgnoreProperties(ignoreUnknown = true) 18 | @JsonPropertyOrder(alphabetic = true) 19 | public class Commitment { 20 | @JsonProperty("port_id") 21 | @SerializedName("port_id") 22 | private String portId; 23 | 24 | @JsonProperty("channel_id") 25 | @SerializedName("channel_id") 26 | private String channelId; 27 | 28 | @JsonProperty("sequence") 29 | @SerializedName("sequence") 30 | private String sequence; 31 | 32 | @JsonProperty("data") 33 | @SerializedName("data") 34 | private String data; 35 | 36 | @Override 37 | public String toString() { 38 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 39 | .append("portId", portId) 40 | .append("channelId", channelId) 41 | .append("sequence", sequence) 42 | .append("data", data) 43 | .toString(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/ibc/channel/ConnectionChannelsResponse.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.ibc.channel; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 7 | import com.google.gson.annotations.SerializedName; 8 | import com.okexchain.msg.common.Height; 9 | import com.okexchain.msg.common.Pagination; 10 | import lombok.AllArgsConstructor; 11 | import lombok.Data; 12 | import lombok.NoArgsConstructor; 13 | 14 | import java.util.List; 15 | 16 | @Data 17 | @AllArgsConstructor 18 | @NoArgsConstructor 19 | @JsonIgnoreProperties(ignoreUnknown = true) 20 | @JsonPropertyOrder(alphabetic = true) 21 | public class ConnectionChannelsResponse { 22 | 23 | @JsonProperty("channels") 24 | @SerializedName("channels") 25 | private List channels; 26 | 27 | @JsonProperty("pagination") 28 | @SerializedName("pagination") 29 | private Pagination pagination; 30 | 31 | @JsonProperty("height") 32 | @SerializedName("height") 33 | private Height height; 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/ibc/channel/PacketCommitmentResponse.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.ibc.channel; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import com.okexchain.msg.common.Height; 8 | import lombok.AllArgsConstructor; 9 | import lombok.Data; 10 | import lombok.NoArgsConstructor; 11 | 12 | @Data 13 | @AllArgsConstructor 14 | @NoArgsConstructor 15 | @JsonIgnoreProperties(ignoreUnknown = true) 16 | @JsonPropertyOrder(alphabetic = true) 17 | public class PacketCommitmentResponse { 18 | @JsonProperty("commitment") 19 | @SerializedName("commitment") 20 | private String commitment; 21 | 22 | 23 | @JsonProperty("proof") 24 | @SerializedName("proof") 25 | private String proof; 26 | 27 | 28 | @JsonProperty("proof_height") 29 | @SerializedName("proof_height") 30 | private Height height; 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/ibc/client/ClientStateResponse.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.ibc.client; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 7 | import com.google.gson.annotations.SerializedName; 8 | import com.okexchain.msg.common.Height; 9 | import lombok.AllArgsConstructor; 10 | import lombok.Data; 11 | import lombok.NoArgsConstructor; 12 | 13 | @Data 14 | @AllArgsConstructor 15 | @NoArgsConstructor 16 | @JsonIgnoreProperties(ignoreUnknown = true) 17 | @JsonPropertyOrder(alphabetic = true) 18 | public class ClientStateResponse { 19 | 20 | 21 | @JsonProperty("client_state") 22 | @SerializedName("client_state") 23 | private ClientState clientState; 24 | 25 | @JsonProperty("proof") 26 | @SerializedName("proof") 27 | private String proof; 28 | 29 | @JsonProperty("proof_height") 30 | @SerializedName("proof_height") 31 | private Height proofHeight; 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/ibc/client/ClientStates.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.ibc.client; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 7 | import com.google.gson.annotations.SerializedName; 8 | import lombok.AllArgsConstructor; 9 | import lombok.Data; 10 | import lombok.NoArgsConstructor; 11 | 12 | @Data 13 | @AllArgsConstructor 14 | @NoArgsConstructor 15 | @JsonIgnoreProperties(ignoreUnknown = true) 16 | @JsonPropertyOrder(alphabetic = true) 17 | public class ClientStates { 18 | 19 | @JsonProperty("client_id") 20 | @SerializedName("client_id") 21 | private String clientId; 22 | 23 | @JsonProperty("client_state") 24 | @SerializedName("client_state") 25 | private ClientState clientState; 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/ibc/client/ClientStatesResponse.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.ibc.client; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 7 | import com.google.gson.annotations.SerializedName; 8 | import com.okexchain.msg.common.Pagination; 9 | import lombok.AllArgsConstructor; 10 | import lombok.Data; 11 | import lombok.NoArgsConstructor; 12 | 13 | import java.util.List; 14 | 15 | @Data 16 | @AllArgsConstructor 17 | @NoArgsConstructor 18 | @JsonIgnoreProperties(ignoreUnknown = true) 19 | @JsonPropertyOrder(alphabetic = true) 20 | public class ClientStatesResponse { 21 | 22 | @JsonProperty("client_states") 23 | @SerializedName("client_states") 24 | private List clientStates; 25 | 26 | @JsonProperty("pagination") 27 | @SerializedName("pagination") 28 | private Pagination pagination; 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/ibc/client/InnerSpec.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.ibc.client; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import lombok.AllArgsConstructor; 8 | import lombok.Data; 9 | import lombok.NoArgsConstructor; 10 | 11 | import java.util.List; 12 | 13 | @Data 14 | @AllArgsConstructor 15 | @NoArgsConstructor 16 | @JsonIgnoreProperties(ignoreUnknown = true) 17 | @JsonPropertyOrder(alphabetic = true) 18 | public class InnerSpec { 19 | 20 | @JsonProperty("child_order") 21 | @SerializedName("child_order") 22 | private List childOrder; 23 | 24 | @JsonProperty("child_size") 25 | @SerializedName("child_size") 26 | private int childSize; 27 | 28 | @JsonProperty("min_prefix_length") 29 | @SerializedName("min_prefix_length") 30 | private int minPrefixLength; 31 | 32 | @JsonProperty("max_prefix_length") 33 | @SerializedName("max_prefix_length") 34 | private int maxPrefixLength; 35 | 36 | @JsonProperty("empty_child") 37 | @SerializedName("empty_child") 38 | private String emptyChild; 39 | 40 | @JsonProperty("hash") 41 | @SerializedName("hash") 42 | private String hash; 43 | } -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/ibc/client/LeafSpec.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.ibc.client; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import lombok.AllArgsConstructor; 8 | import lombok.Data; 9 | import lombok.NoArgsConstructor; 10 | 11 | @Data 12 | @AllArgsConstructor 13 | @NoArgsConstructor 14 | @JsonIgnoreProperties(ignoreUnknown = true) 15 | @JsonPropertyOrder(alphabetic = true) 16 | public class LeafSpec { 17 | 18 | @JsonProperty("hash") 19 | @SerializedName("hash") 20 | private String hash; 21 | 22 | @JsonProperty("prehash_key") 23 | @SerializedName("prehash_key") 24 | private String prehashKey; 25 | 26 | @JsonProperty("prehash_value") 27 | @SerializedName("prehash_value") 28 | private String prehashValue; 29 | 30 | @JsonProperty("length") 31 | @SerializedName("length") 32 | private String length; 33 | 34 | @JsonProperty("prefix") 35 | @SerializedName("prefix") 36 | private String prefix; 37 | } -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/ibc/client/ProofSpecs.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.ibc.client; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import lombok.AllArgsConstructor; 8 | import lombok.Data; 9 | import lombok.NoArgsConstructor; 10 | 11 | @Data 12 | @AllArgsConstructor 13 | @NoArgsConstructor 14 | @JsonIgnoreProperties(ignoreUnknown = true) 15 | @JsonPropertyOrder(alphabetic = true) 16 | public class ProofSpecs { 17 | 18 | @JsonProperty("leaf_spec") 19 | @SerializedName("leaf_spec") 20 | private LeafSpec leafSpecpec; 21 | 22 | 23 | @JsonProperty("inner_spec") 24 | @SerializedName("inner_spec") 25 | private InnerSpec innerSpec; 26 | 27 | 28 | @JsonProperty("max_depth") 29 | @SerializedName("max_depth") 30 | private int maxDepth; 31 | 32 | 33 | @JsonProperty("min_depth") 34 | @SerializedName("min_depth") 35 | private int minDepth; 36 | } -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/ibc/client/TrustLevel.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.ibc.client; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import lombok.AllArgsConstructor; 8 | import lombok.Data; 9 | import lombok.NoArgsConstructor; 10 | 11 | 12 | @Data 13 | @AllArgsConstructor 14 | @NoArgsConstructor 15 | @JsonIgnoreProperties(ignoreUnknown = true) 16 | @JsonPropertyOrder(alphabetic = true) 17 | public class TrustLevel { 18 | @JsonProperty("numerator") 19 | @SerializedName("numerator") 20 | private String numerator; 21 | 22 | @JsonProperty("denominator") 23 | @SerializedName("denominator") 24 | private String denominator; 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/ibc/connection/ClientConnectionsResponse.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.ibc.connection; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 7 | import com.google.gson.annotations.SerializedName; 8 | import com.okexchain.msg.common.Height; 9 | import lombok.AllArgsConstructor; 10 | import lombok.Data; 11 | import lombok.NoArgsConstructor; 12 | 13 | import java.util.List; 14 | 15 | @Data 16 | @AllArgsConstructor 17 | @NoArgsConstructor 18 | @JsonIgnoreProperties(ignoreUnknown = true) 19 | @JsonPropertyOrder(alphabetic = true) 20 | public class ClientConnectionsResponse { 21 | 22 | @JsonProperty("connection_paths") 23 | @SerializedName("connection_paths") 24 | private List connectionPaths; 25 | 26 | @JsonProperty("proof") 27 | @SerializedName("proof") 28 | private String proof; 29 | 30 | @JsonProperty("proof_height") 31 | @SerializedName("proof_height") 32 | private Height proofHeight; 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/ibc/connection/Connection.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.ibc.connection; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 7 | import com.google.gson.annotations.SerializedName; 8 | import lombok.AllArgsConstructor; 9 | import lombok.Data; 10 | import lombok.NoArgsConstructor; 11 | 12 | import java.util.List; 13 | 14 | @Data 15 | @AllArgsConstructor 16 | @NoArgsConstructor 17 | @JsonIgnoreProperties(ignoreUnknown = true) 18 | @JsonPropertyOrder(alphabetic = true) 19 | public class Connection { 20 | 21 | @JsonProperty("client_id") 22 | @SerializedName("client_id") 23 | private String clientId; 24 | 25 | @JsonProperty("versions") 26 | @SerializedName("versions") 27 | private List versions; 28 | 29 | @JsonProperty("state") 30 | @SerializedName("state") 31 | private String state; 32 | 33 | @JsonProperty("counterparty") 34 | @SerializedName("counterparty") 35 | private CounterPartyPrefix counterPartyPrefix; 36 | 37 | @JsonProperty("delay_period") 38 | @SerializedName("delay_period") 39 | private String delayPeriod; 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/ibc/connection/ConnectionResponse.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.ibc.connection; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 7 | import com.google.gson.annotations.SerializedName; 8 | import com.okexchain.msg.common.Height; 9 | import lombok.AllArgsConstructor; 10 | import lombok.Data; 11 | import lombok.NoArgsConstructor; 12 | 13 | @Data 14 | @AllArgsConstructor 15 | @NoArgsConstructor 16 | @JsonIgnoreProperties(ignoreUnknown = true) 17 | @JsonPropertyOrder(alphabetic = true) 18 | public class ConnectionResponse { 19 | 20 | @JsonProperty("connection") 21 | @SerializedName("connection") 22 | private Connection connection; 23 | 24 | @JsonProperty("proof") 25 | @SerializedName("proof") 26 | private String proof; 27 | 28 | 29 | @JsonProperty("proof_height") 30 | @SerializedName("proof_height") 31 | private Height height; 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/ibc/connection/Connections.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.ibc.connection; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 7 | import com.google.gson.annotations.SerializedName; 8 | import lombok.AllArgsConstructor; 9 | import lombok.Data; 10 | import lombok.NoArgsConstructor; 11 | 12 | import java.util.List; 13 | 14 | @Data 15 | @AllArgsConstructor 16 | @NoArgsConstructor 17 | @JsonIgnoreProperties(ignoreUnknown = true) 18 | @JsonPropertyOrder(alphabetic = true) 19 | public class Connections { 20 | 21 | @JsonProperty("id") 22 | @SerializedName("id") 23 | private String id; 24 | 25 | @JsonProperty("client_id") 26 | @SerializedName("client_id") 27 | private String clientId; 28 | 29 | @JsonProperty("versions") 30 | @SerializedName("versions") 31 | private List versions; 32 | 33 | @JsonProperty("state") 34 | @SerializedName("state") 35 | private String state; 36 | 37 | @JsonProperty("counterparty") 38 | @SerializedName("counterparty") 39 | private CounterPartyPrefix counterPartyPrefix; 40 | 41 | @JsonProperty("delay_period") 42 | @SerializedName("delay_period") 43 | private String delayPeriod; 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/ibc/connection/ConnectionsResponse.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.ibc.connection; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 7 | import com.google.gson.annotations.SerializedName; 8 | import com.okexchain.msg.common.Height; 9 | import com.okexchain.msg.common.Pagination; 10 | import lombok.AllArgsConstructor; 11 | import lombok.Data; 12 | import lombok.NoArgsConstructor; 13 | 14 | import java.util.List; 15 | 16 | @Data 17 | @AllArgsConstructor 18 | @NoArgsConstructor 19 | @JsonIgnoreProperties(ignoreUnknown = true) 20 | @JsonPropertyOrder(alphabetic = true) 21 | public class ConnectionsResponse { 22 | 23 | 24 | @JsonProperty("connections") 25 | @SerializedName("connections") 26 | private List connections; 27 | 28 | 29 | @JsonProperty("pagination") 30 | @SerializedName("pagination") 31 | private Pagination pagination; 32 | 33 | 34 | @JsonProperty("height") 35 | @SerializedName("height") 36 | private Height height; 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/ibc/connection/CounterPartyPrefix.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.ibc.connection; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import lombok.AllArgsConstructor; 8 | import lombok.Data; 9 | import lombok.NoArgsConstructor; 10 | 11 | @Data 12 | @AllArgsConstructor 13 | @NoArgsConstructor 14 | @JsonIgnoreProperties(ignoreUnknown = true) 15 | @JsonPropertyOrder(alphabetic = true) 16 | public class CounterPartyPrefix { 17 | @JsonProperty("client_id") 18 | @SerializedName("client_id") 19 | private String clientId; 20 | 21 | @JsonProperty("connection_id") 22 | @SerializedName("connection_id") 23 | private String connectionId; 24 | 25 | @JsonProperty("prefix") 26 | @SerializedName("prefix") 27 | private Prefix prefix; 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/ibc/connection/Prefix.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.ibc.connection; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import lombok.AllArgsConstructor; 8 | import lombok.Data; 9 | import lombok.NoArgsConstructor; 10 | 11 | @Data 12 | @AllArgsConstructor 13 | @NoArgsConstructor 14 | @JsonIgnoreProperties(ignoreUnknown = true) 15 | @JsonPropertyOrder(alphabetic = true) 16 | public class Prefix { 17 | 18 | @JsonProperty("key_prefix") 19 | @SerializedName("key_prefix") 20 | private String keyPrefix; 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/ibc/connection/Versions.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.ibc.connection; 2 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 5 | import com.google.gson.annotations.SerializedName; 6 | import lombok.AllArgsConstructor; 7 | import lombok.Data; 8 | import lombok.NoArgsConstructor; 9 | 10 | import java.util.List; 11 | 12 | 13 | @Data 14 | @AllArgsConstructor 15 | @NoArgsConstructor 16 | @JsonIgnoreProperties(ignoreUnknown = true) 17 | @JsonPropertyOrder(alphabetic = true) 18 | public class Versions { 19 | 20 | @JsonProperty("identifier") 21 | @SerializedName("identifier") 22 | private String identifier; 23 | 24 | @JsonProperty("features") 25 | @SerializedName("features") 26 | private List features; 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/ibc/transfer/DenomTraceResponse.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.ibc.transfer; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import com.okexchain.msg.common.DenomTrace; 8 | 9 | 10 | @JsonIgnoreProperties(ignoreUnknown = true) 11 | @JsonPropertyOrder(alphabetic = true) 12 | public class DenomTraceResponse { 13 | 14 | @JsonProperty("denom_trace") 15 | @SerializedName("denom_trace") 16 | private DenomTrace denomTrace; 17 | 18 | public DenomTraceResponse() { 19 | } 20 | 21 | public DenomTraceResponse(DenomTrace denomTrace) { 22 | this.denomTrace = denomTrace; 23 | } 24 | 25 | public DenomTrace getDenomTrace() { 26 | return denomTrace; 27 | } 28 | 29 | public void setDenomTrace(DenomTrace denomTrace) { 30 | this.denomTrace = denomTrace; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/ibc/transfer/DenomTracesResponse.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.ibc.transfer; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import com.okexchain.msg.common.DenomTrace; 8 | import com.okexchain.msg.common.Pagination; 9 | 10 | import java.util.List; 11 | 12 | @JsonIgnoreProperties(ignoreUnknown = true) 13 | @JsonPropertyOrder(alphabetic = true) 14 | public class DenomTracesResponse{ 15 | 16 | @JsonProperty("denom_traces") 17 | @SerializedName("denom_traces") 18 | private List denomTraces; 19 | 20 | 21 | @JsonProperty("pagination") 22 | @SerializedName("pagination") 23 | private Pagination pagination; 24 | 25 | public List getDenomTraces() { 26 | return denomTraces; 27 | } 28 | 29 | public void setDenomTraces(List denomTraces) { 30 | this.denomTraces = denomTraces; 31 | } 32 | 33 | public Pagination getPagination() { 34 | return pagination; 35 | } 36 | 37 | public void setPagination(Pagination pagination) { 38 | this.pagination = pagination; 39 | } 40 | 41 | @Override 42 | public String toString() { 43 | return "DenomTracesResponse{" + 44 | "denomTraces=" + denomTraces + 45 | ", pagination=" + pagination.toString() + 46 | '}'; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/ibc/transfer/Params.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.ibc.transfer; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | @JsonIgnoreProperties(ignoreUnknown = true) 9 | @JsonPropertyOrder(alphabetic = true) 10 | public class Params { 11 | 12 | @JsonProperty("send_enabled") 13 | @SerializedName("send_enabled") 14 | private boolean sendEnabled; 15 | 16 | @JsonProperty("receive_enabled") 17 | @SerializedName("receive_enabled") 18 | private boolean receiveEnabled; 19 | 20 | public Params() { 21 | } 22 | 23 | public Params(boolean sendEnabled, boolean receiveEnabled) { 24 | this.sendEnabled = sendEnabled; 25 | this.receiveEnabled = receiveEnabled; 26 | } 27 | 28 | public boolean isSendEnabled() { 29 | return sendEnabled; 30 | } 31 | 32 | public void setSendEnabled(boolean sendEnabled) { 33 | this.sendEnabled = sendEnabled; 34 | } 35 | 36 | public boolean isReceiveEnabled() { 37 | return receiveEnabled; 38 | } 39 | 40 | public void setReceiveEnabled(boolean receiveEnabled) { 41 | this.receiveEnabled = receiveEnabled; 42 | } 43 | 44 | @Override 45 | public String toString() { 46 | return "Params{" + 47 | "sendEnabled=" + sendEnabled + 48 | ", receiveEnabled=" + receiveEnabled + 49 | '}'; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/ibc/transfer/ParamsResponse.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.ibc.transfer; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | @JsonIgnoreProperties(ignoreUnknown = true) 9 | @JsonPropertyOrder(alphabetic = true) 10 | public class ParamsResponse { 11 | 12 | @JsonProperty("params") 13 | @SerializedName("params") 14 | private Params params; 15 | 16 | public ParamsResponse() { 17 | } 18 | 19 | public ParamsResponse(Params params) { 20 | this.params = params; 21 | } 22 | 23 | public Params getParams() { 24 | return params; 25 | } 26 | 27 | public void setParams(Params params) { 28 | this.params = params; 29 | } 30 | 31 | @Override 32 | public String toString() { 33 | return "ParamsResponse{" + 34 | "params=" + params + 35 | '}'; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/ibc/tx/TxEvent.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.ibc.tx; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | @Data 10 | @AllArgsConstructor 11 | @NoArgsConstructor 12 | @JsonIgnoreProperties(ignoreUnknown = true) 13 | @JsonPropertyOrder(alphabetic = true) 14 | public class TxEvent { 15 | private String action; 16 | private String sender; 17 | private String page; 18 | private String limit; 19 | private String minHeight; 20 | private String maxHeight; 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/order/MsgCancelOrdersValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.order; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import org.apache.commons.lang3.builder.ToStringBuilder; 8 | import org.apache.commons.lang3.builder.ToStringStyle; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown = true) 11 | @JsonPropertyOrder(alphabetic = true) 12 | public class MsgCancelOrdersValue { 13 | 14 | @JsonProperty("order_ids") 15 | @SerializedName("order_ids") 16 | private String [] orderIDs; 17 | 18 | @JsonProperty("sender") 19 | @SerializedName("sender") 20 | private String sender; 21 | 22 | public void setOrderIDs(String [] orderIDs) { 23 | this.orderIDs = orderIDs; 24 | } 25 | 26 | public String getSender() { 27 | return sender; 28 | } 29 | 30 | public void setSender(String sender) { 31 | this.sender = sender; 32 | } 33 | 34 | @Override 35 | public String toString() { 36 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 37 | .append("sender", sender) 38 | .append("order_ids", orderIDs) 39 | .toString(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/order/MsgNewOrdersValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.order; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import org.apache.commons.lang3.builder.ToStringBuilder; 8 | import org.apache.commons.lang3.builder.ToStringStyle; 9 | 10 | import java.util.List; 11 | 12 | @JsonIgnoreProperties(ignoreUnknown = true) 13 | @JsonPropertyOrder(alphabetic = true) 14 | public class MsgNewOrdersValue { 15 | 16 | @JsonProperty("order_items") 17 | @SerializedName("order_items") 18 | private List orderItems; 19 | 20 | @JsonProperty("sender") 21 | @SerializedName("sender") 22 | private String sender; 23 | 24 | public List getOrderItems() { 25 | return orderItems; 26 | } 27 | 28 | public void setNewOrderItem(List orderItems) { 29 | this.orderItems = orderItems; 30 | } 31 | 32 | public String getSender() { 33 | return sender; 34 | } 35 | 36 | public void setSender(String sender) { 37 | this.sender = sender; 38 | } 39 | 40 | @Override 41 | public String toString() { 42 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 43 | .append("sender", sender) 44 | .append("order_items", orderItems) 45 | .toString(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/reward/MsgEditValidatorCommissionRateValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.reward; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 7 | import com.google.gson.annotations.SerializedName; 8 | import com.okexchain.utils.Utils; 9 | import lombok.AllArgsConstructor; 10 | import lombok.Data; 11 | import lombok.NoArgsConstructor; 12 | 13 | import java.math.BigDecimal; 14 | 15 | 16 | @Data 17 | @AllArgsConstructor 18 | @NoArgsConstructor 19 | @JsonIgnoreProperties(ignoreUnknown = true) 20 | @JsonPropertyOrder(alphabetic = true) 21 | public class MsgEditValidatorCommissionRateValue { 22 | 23 | 24 | @JsonProperty("commission_rate") 25 | @SerializedName("commission_rate") 26 | private String commissionRate; 27 | 28 | @JsonProperty("address") 29 | @SerializedName("address") 30 | private String validatorAddress; 31 | 32 | 33 | public void setCommissionRate(BigDecimal commissionRate) throws Exception { 34 | int n1 = commissionRate.compareTo(new BigDecimal(0)); 35 | int n2 = commissionRate.compareTo(new BigDecimal(1)); 36 | if ((n1 == 0 || n1 == 1) && (n2 == -1 || n2 == 0)) { 37 | this.commissionRate = Utils.NewDecString(String.valueOf(commissionRate)); 38 | } else { 39 | throw new Exception("data range is [0,1]"); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/reward/MsgWithdrawDelegatorAllRewardsValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.reward; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 7 | import com.google.gson.annotations.SerializedName; 8 | import lombok.AllArgsConstructor; 9 | import lombok.Data; 10 | import lombok.NoArgsConstructor; 11 | 12 | @Data 13 | @AllArgsConstructor 14 | @NoArgsConstructor 15 | @JsonIgnoreProperties(ignoreUnknown = true) 16 | @JsonPropertyOrder(alphabetic = true) 17 | public class MsgWithdrawDelegatorAllRewardsValue { 18 | @JsonProperty("delegator_address") 19 | @SerializedName("delegator_address") 20 | private String delegatorAddress; 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/reward/MsgWithdrawDelegatorRewardValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.reward; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 7 | import com.google.gson.annotations.SerializedName; 8 | import lombok.AllArgsConstructor; 9 | import lombok.Data; 10 | import lombok.NoArgsConstructor; 11 | 12 | @Data 13 | @AllArgsConstructor 14 | @NoArgsConstructor 15 | @JsonIgnoreProperties(ignoreUnknown = true) 16 | @JsonPropertyOrder(alphabetic = true) 17 | public class MsgWithdrawDelegatorRewardValue { 18 | 19 | 20 | @JsonProperty("delegator_address") 21 | @SerializedName("delegator_address") 22 | private String delegatorAddress; 23 | 24 | 25 | @JsonProperty("validator_address") 26 | @SerializedName("validator_address") 27 | private String validatorAddress; 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/slashing/MsgUnjail.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.slashing; 2 | 3 | import com.okexchain.env.EnvInstance; 4 | import com.okexchain.msg.MsgBase; 5 | import com.okexchain.msg.common.Message; 6 | 7 | public class MsgUnjail extends MsgBase { 8 | public MsgUnjail () { 9 | setMsgType("cosmos-sdk/MsgUnjail"); 10 | } 11 | 12 | public static void main(String[] args) { 13 | EnvInstance.setEnv("okl"); 14 | MsgUnjail msg = new MsgUnjail(); 15 | msg.initMnemonic(""); 16 | Message messages = msg.produceMsg("okexchainvaloper10q0rk5qnyag7wfvvt7rtphlw589m7frshchly8"); 17 | msg.submit(messages, "100000.00000000", "200000", ""); 18 | } 19 | 20 | public Message produceMsg(String operAddress) { 21 | MsgUnjailValue value = new MsgUnjailValue(); 22 | value.setAddress(operAddress); 23 | 24 | Message msg = new Message<>(); 25 | msg.setType(msgType); 26 | msg.setValue(value); 27 | return msg; 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/slashing/MsgUnjailValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.slashing; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import org.apache.commons.lang3.builder.ToStringBuilder; 8 | import org.apache.commons.lang3.builder.ToStringStyle; 9 | 10 | 11 | @JsonIgnoreProperties(ignoreUnknown = true) 12 | @JsonPropertyOrder(alphabetic = true) 13 | public class MsgUnjailValue { 14 | 15 | @JsonProperty("address") 16 | @SerializedName("address") 17 | private String address; 18 | 19 | public void setAddress(String address) { 20 | this.address = address; 21 | } 22 | 23 | @Override 24 | public String toString() { 25 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 26 | .append("address", address) 27 | .toString(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/staking/MsgAddSharesValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.staking; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import org.apache.commons.lang3.builder.ToStringBuilder; 8 | import org.apache.commons.lang3.builder.ToStringStyle; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown = true) 11 | @JsonPropertyOrder(alphabetic = true) 12 | public class MsgAddSharesValue { 13 | @JsonProperty("delegator_address") 14 | @SerializedName("delegator_address") 15 | private String delAddr; 16 | 17 | @JsonProperty("validator_addresses") 18 | @SerializedName("validator_addresses") 19 | private String [] valAddrs; 20 | 21 | public void setDelAddr(String delAddr) { 22 | this.delAddr = delAddr; 23 | } 24 | 25 | public void setValAddrs(String [] valAddrs) { 26 | this.valAddrs = valAddrs; 27 | } 28 | 29 | 30 | @Override 31 | public String toString() { 32 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 33 | .append("delegator_address", this.delAddr) 34 | .append("validator_addresses", this.valAddrs) 35 | .toString(); 36 | } 37 | 38 | } 39 | 40 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/staking/MsgBindProxy.java: -------------------------------------------------------------------------------- 1 | 2 | package com.okexchain.msg.staking; 3 | 4 | import com.okexchain.env.EnvInstance; 5 | import com.okexchain.msg.MsgBase; 6 | import com.okexchain.msg.common.Message; 7 | 8 | public class MsgBindProxy extends MsgBase { 9 | 10 | public MsgBindProxy() { 11 | setMsgType("okexchain/staking/MsgBindProxy"); 12 | } 13 | public static void main(String[] args) { 14 | EnvInstance.setEnv("okq"); 15 | 16 | MsgBindProxy msg = new MsgBindProxy(); 17 | msg.initMnemonic(""); 18 | 19 | Message messages = msg.produceMsg("okexchain1fqc7fw5ka5md4jyrnj53n2m82f5jewz9vrvnan", "okexchain10q0rk5qnyag7wfvvt7rtphlw589m7frsku8qc9"); 20 | 21 | msg.submit(messages, "6.00000000", "200000", ""); 22 | } 23 | 24 | public Message produceMsg(String delegator_address, String proxy_address) { 25 | MsgBindProxyValue value = new MsgBindProxyValue(); 26 | 27 | System.out.println("this.operAddress:"); 28 | System.out.println(this.operAddress); 29 | 30 | value.setDelAddress(delegator_address); 31 | value.setProxyAddress(proxy_address); 32 | 33 | Message msg = new Message<>(); 34 | msg.setType(msgType); 35 | msg.setValue(value); 36 | return msg; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/staking/MsgBindProxyValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.staking; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import org.apache.commons.lang3.builder.ToStringBuilder; 8 | import org.apache.commons.lang3.builder.ToStringStyle; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown = true) 11 | @JsonPropertyOrder(alphabetic = true) 12 | public class MsgBindProxyValue { 13 | 14 | @JsonProperty("delegator_address") 15 | @SerializedName("delegator_address") 16 | private String delAddress; 17 | 18 | @JsonProperty("proxy_address") 19 | @SerializedName("proxy_address") 20 | private String proxyAddress; 21 | 22 | 23 | public void setDelAddress(String delAddress) { 24 | this.delAddress = delAddress; 25 | } 26 | public void setProxyAddress(String proxyAddress) { 27 | this.proxyAddress = proxyAddress; 28 | } 29 | 30 | @Override 31 | public String toString() { 32 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 33 | .append("proxy_address", this.delAddress) 34 | .append("reg", this.proxyAddress) 35 | .toString(); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/staking/MsgDepositValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.staking; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import com.okexchain.msg.common.DecCoin; 8 | import org.apache.commons.lang3.builder.ToStringBuilder; 9 | import org.apache.commons.lang3.builder.ToStringStyle; 10 | 11 | @JsonIgnoreProperties(ignoreUnknown = true) 12 | @JsonPropertyOrder(alphabetic = true) 13 | public class MsgDepositValue { 14 | 15 | @JsonProperty("delegator_address") 16 | @SerializedName("delegator_address") 17 | private String delegatorAddress; 18 | 19 | @JsonProperty("quantity") 20 | @SerializedName("quantity") 21 | private DecCoin amount; 22 | 23 | public void setDelegatorAddress(String delegatorAddress) { 24 | this.delegatorAddress = delegatorAddress; 25 | } 26 | 27 | public void setAmount(DecCoin amount) { 28 | this.amount = amount; 29 | } 30 | 31 | 32 | @Override 33 | public String toString() { 34 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 35 | .append("delegatorAddress", this.delegatorAddress) 36 | .append("amount", this.amount) 37 | .toString(); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/staking/MsgDestroyValidator.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.staking; 2 | 3 | import com.okexchain.msg.MsgBase; 4 | import com.okexchain.msg.common.Message; 5 | 6 | public class MsgDestroyValidator extends MsgBase { 7 | 8 | public MsgDestroyValidator() { setMsgType("okexchain/staking/MsgDestroyValidator"); } 9 | 10 | public Message produceMsg() { 11 | 12 | MsgDestroyValidatorValue value = new MsgDestroyValidatorValue(); 13 | 14 | value.setDelegatorAddress(this.address); 15 | 16 | Message msg = new Message<>(); 17 | msg.setType(msgType); 18 | msg.setValue(value); 19 | return msg; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/staking/MsgDestroyValidatorValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.staking; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import org.apache.commons.lang3.builder.ToStringBuilder; 8 | import org.apache.commons.lang3.builder.ToStringStyle; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown = true) 11 | @JsonPropertyOrder(alphabetic = true) 12 | public class MsgDestroyValidatorValue { 13 | 14 | @JsonProperty("delegator_address") 15 | @SerializedName("delegator_address") 16 | private String delegatorAddress; 17 | 18 | public String getDelegatorAddress() { 19 | return delegatorAddress; 20 | } 21 | 22 | public void setDelegatorAddress(String delegatorAddress) { 23 | this.delegatorAddress = delegatorAddress; 24 | } 25 | 26 | @Override 27 | public String toString() { 28 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 29 | .append("delegator_address", delegatorAddress) 30 | .toString(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/staking/MsgEditValidator.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.staking; 2 | 3 | import com.okexchain.env.EnvInstance; 4 | import com.okexchain.msg.MsgBase; 5 | import com.okexchain.msg.common.Message; 6 | import com.okexchain.msg.common.Description; 7 | 8 | public class MsgEditValidator extends MsgBase { 9 | public MsgEditValidator() { 10 | setMsgType("okexchain/staking/MsgEditValidator"); 11 | } 12 | public static void main(String[] args) { 13 | EnvInstance.setEnv("okq"); 14 | 15 | MsgEditValidator msg = new MsgEditValidator(); 16 | msg.setMsgType("okexchain/staking/MsgEditValidator"); 17 | msg.initMnemonic(""); 18 | 19 | Message messages = msg.produceMsg("1","1","1","1", "okexchainvaloper10q0rk5qnyag7wfvvt7rtphlw589m7frshchly8"); 20 | 21 | msg.submit(messages, "6.00000000", "200000", ""); 22 | } 23 | 24 | public Message produceMsg(String details, String identity, String moniker, String website, String operAddress) { 25 | 26 | Description d = new Description(); 27 | d.setDetails(details); 28 | d.setIdentity(identity); 29 | d.setMoniker(moniker); 30 | d.setWebsite(website); 31 | 32 | MsgEditValidatorValue value = new MsgEditValidatorValue(); 33 | 34 | value.setAddress(operAddress); 35 | 36 | value.setDescription(d); 37 | 38 | Message msg = new Message<>(); 39 | msg.setType(msgType); 40 | msg.setValue(value); 41 | return msg; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/staking/MsgEditValidatorValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.staking; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import com.okexchain.msg.common.Description; 8 | import org.apache.commons.lang3.builder.ToStringBuilder; 9 | import org.apache.commons.lang3.builder.ToStringStyle; 10 | 11 | @JsonIgnoreProperties(ignoreUnknown = true) 12 | @JsonPropertyOrder(alphabetic = true) 13 | public class MsgEditValidatorValue { 14 | 15 | @JsonProperty("Description") 16 | @SerializedName("Description") 17 | private Description description; 18 | 19 | @JsonProperty("address") 20 | @SerializedName("address") 21 | private String address; 22 | 23 | public void setDescription(Description description) { 24 | this.description = description; 25 | } 26 | 27 | public void setAddress(String address) { 28 | this.address = address; 29 | } 30 | 31 | 32 | @Override 33 | public String toString() { 34 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 35 | .append("address", address) 36 | .append("Description", this.description) 37 | .toString(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/staking/MsgRegProxy.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.staking; 2 | 3 | import com.okexchain.env.EnvInstance; 4 | import com.okexchain.msg.MsgBase; 5 | import com.okexchain.msg.common.Message; 6 | 7 | public class MsgRegProxy extends MsgBase { 8 | 9 | public MsgRegProxy() { 10 | setMsgType("okexchain/staking/MsgRegProxy"); 11 | } 12 | 13 | public static void main(String[] args) { 14 | EnvInstance.setEnv("okq"); 15 | 16 | MsgRegProxy msg = new MsgRegProxy(); 17 | msg.initMnemonic(""); 18 | 19 | Message messages = msg.produceMsg("okexchain10q0rk5qnyag7wfvvt7rtphlw589m7frsku8qc9", true); 20 | 21 | msg.submit(messages, "6.00000000", "200000", ""); 22 | } 23 | 24 | public Message produceMsg(String proxyAddress, boolean reg) { 25 | MsgRegProxyValue value = new MsgRegProxyValue(); 26 | 27 | System.out.println("this.operAddress:"); 28 | System.out.println(this.operAddress); 29 | 30 | value.setProxyAddress(proxyAddress); 31 | value.setReg(reg); 32 | 33 | Message msg = new Message<>(); 34 | msg.setType(msgType); 35 | msg.setValue(value); 36 | return msg; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/staking/MsgRegProxyValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.staking; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import org.apache.commons.lang3.builder.ToStringBuilder; 8 | import org.apache.commons.lang3.builder.ToStringStyle; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown = true) 11 | @JsonPropertyOrder(alphabetic = true) 12 | public class MsgRegProxyValue { 13 | @JsonProperty("proxy_address") 14 | @SerializedName("proxy_address") 15 | private String proxyAddress; 16 | 17 | @JsonProperty("reg") 18 | @SerializedName("reg") 19 | private boolean reg; 20 | 21 | public void setProxyAddress(String proxyAddress) { 22 | this.proxyAddress = proxyAddress; 23 | } 24 | 25 | public void setReg(boolean reg) { 26 | this.reg = reg; 27 | } 28 | 29 | @Override 30 | public String toString() { 31 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 32 | .append("proxy_address", this.proxyAddress) 33 | .append("reg", this.reg) 34 | .toString(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/staking/MsgUnbindProxy.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.staking; 2 | 3 | import com.okexchain.msg.MsgBase; 4 | import com.okexchain.msg.common.Message; 5 | 6 | public class MsgUnbindProxy extends MsgBase { 7 | 8 | public MsgUnbindProxy() { setMsgType("okexchain/staking/MsgUnbindProxy"); } 9 | 10 | public Message produce() { 11 | 12 | MsgUnbindProxyValue value = new MsgUnbindProxyValue(); 13 | 14 | value.setDelegatorAddress(this.address); 15 | 16 | Message msg = new Message<>(); 17 | msg.setType(msgType); 18 | msg.setValue(value); 19 | return msg; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/staking/MsgUnbindProxyValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.staking; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import org.apache.commons.lang3.builder.ToStringBuilder; 8 | import org.apache.commons.lang3.builder.ToStringStyle; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown = true) 11 | @JsonPropertyOrder(alphabetic = true) 12 | public class MsgUnbindProxyValue { 13 | 14 | @JsonProperty("delegator_address") 15 | @SerializedName("delegator_address") 16 | private String delegatorAddress; 17 | 18 | public String getDelegatorAddress() { 19 | return delegatorAddress; 20 | } 21 | 22 | public void setDelegatorAddress(String delegatorAddress) { 23 | this.delegatorAddress = delegatorAddress; 24 | } 25 | 26 | @Override 27 | public String toString() { 28 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 29 | .append("delegator_address", delegatorAddress) 30 | .toString(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/staking/MsgWithdrawStaking.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.staking; 2 | 3 | import com.okexchain.env.EnvInstance; 4 | import com.okexchain.msg.MsgBase; 5 | import com.okexchain.msg.common.Message; 6 | import com.okexchain.msg.common.DecCoin; 7 | import com.okexchain.utils.Utils; 8 | 9 | public class MsgWithdrawStaking extends MsgBase { 10 | public MsgWithdrawStaking() { 11 | setMsgType("okexchain/staking/MsgWithdraw"); 12 | } 13 | public static void main(String[] args) { 14 | EnvInstance.setEnv("okq"); 15 | 16 | MsgWithdrawStaking msg = new MsgWithdrawStaking(); 17 | msg.initMnemonic(""); 18 | 19 | Message messages = msg.produceMsg("okt", "10.00000000", "okexchain10q0rk5qnyag7wfvvt7rtphlw589m7frsku8qc9"); 20 | 21 | msg.submit(messages, "6.00000000", "200000", ""); 22 | } 23 | 24 | public Message produceMsg(String denom, String amountDenom, String delegrator) { 25 | 26 | DecCoin d = new DecCoin(); 27 | d.setDenom(denom); 28 | d.setAmount(Utils.NewDecString(amountDenom)); 29 | 30 | MsgWithdrawStakingValue value = new MsgWithdrawStakingValue(); 31 | 32 | System.out.println("this.operAddress:"); 33 | System.out.println(this.operAddress); 34 | 35 | value.setAmount(d); 36 | value.setDelegatorAddress(delegrator); 37 | 38 | System.out.println("println this.operAdddress"); 39 | 40 | Message msg = new Message<>(); 41 | msg.setType(msgType); 42 | msg.setValue(value); 43 | return msg; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/staking/MsgWithdrawStakingValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.staking; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import com.okexchain.msg.common.DecCoin; 8 | import org.apache.commons.lang3.builder.ToStringBuilder; 9 | import org.apache.commons.lang3.builder.ToStringStyle; 10 | 11 | @JsonIgnoreProperties(ignoreUnknown = true) 12 | @JsonPropertyOrder(alphabetic = true) 13 | public class MsgWithdrawStakingValue { 14 | @JsonProperty("delegator_address") 15 | @SerializedName("delegator_address") 16 | private String delegatorAddress; 17 | 18 | @JsonProperty("quantity") 19 | @SerializedName("quantity") 20 | private DecCoin amount; 21 | 22 | public void setDelegatorAddress(String delegatorAddress) { 23 | this.delegatorAddress = delegatorAddress; 24 | } 25 | 26 | public void setAmount(DecCoin amount) { 27 | this.amount = amount; 28 | } 29 | 30 | 31 | @Override 32 | public String toString() { 33 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 34 | .append("delegatorAddress", this.delegatorAddress) 35 | .append("amount", this.amount) 36 | .toString(); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/token/MsgConfirmOwnership.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.token; 2 | 3 | import com.okexchain.msg.MsgBase; 4 | import com.okexchain.msg.common.Message; 5 | 6 | public class MsgConfirmOwnership extends MsgBase { 7 | 8 | public MsgConfirmOwnership() { setMsgType("okexchain/token/MsgConfirmOwnership"); } 9 | 10 | public Message produceConfirmOwnershipMsg(String address, String symbol) { 11 | 12 | MsgConfirmOwnershipValue value = new MsgConfirmOwnershipValue(); 13 | value.setAddress(address); 14 | value.setSymbol(symbol); 15 | 16 | Message msg = new Message<>(); 17 | msg.setType(msgType); 18 | msg.setValue(value); 19 | 20 | return msg; 21 | } 22 | 23 | } -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/token/MsgConfirmOwnershipValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.token; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import org.apache.commons.lang3.builder.ToStringBuilder; 8 | import org.apache.commons.lang3.builder.ToStringStyle; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown = true) 11 | @JsonPropertyOrder(alphabetic = true) 12 | public class MsgConfirmOwnershipValue{ 13 | 14 | @JsonProperty("new_owner") 15 | @SerializedName("new_owner") 16 | private String address; 17 | 18 | @JsonProperty("symbol") 19 | @SerializedName("symbol") 20 | private String symbol; 21 | 22 | public void setAddress(String address) {this.address = address;} 23 | 24 | public void setSymbol(String symbol) {this.symbol = symbol;} 25 | 26 | @Override 27 | public String toString() { 28 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 29 | .append("new_owner", address) 30 | .append("symbol", symbol) 31 | .toString(); 32 | } 33 | } -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/token/MsgMultiTransfer.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.token; 2 | 3 | import com.okexchain.msg.MsgBase; 4 | import com.okexchain.msg.common.Message; 5 | import com.okexchain.msg.common.TransferUnit; 6 | 7 | import java.util.List; 8 | 9 | public class MsgMultiTransfer extends MsgBase { 10 | 11 | public MsgMultiTransfer() { setMsgType("okexchain/token/MsgMultiTransfer"); } 12 | 13 | public Message produceMsg(List transfers) { 14 | 15 | MsgMultiTransferValue value = new MsgMultiTransferValue(); 16 | 17 | value.setFrom(this.address); 18 | value.setTransfers(transfers); 19 | 20 | Message msg = new Message<>(); 21 | msg.setType(msgType); 22 | msg.setValue(value); 23 | return msg; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/token/MsgMultiTransferValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.token; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import com.okexchain.msg.common.TransferUnit; 8 | import org.apache.commons.lang3.builder.ToStringBuilder; 9 | import org.apache.commons.lang3.builder.ToStringStyle; 10 | 11 | import java.util.List; 12 | 13 | @JsonIgnoreProperties(ignoreUnknown = true) 14 | @JsonPropertyOrder(alphabetic = true) 15 | public class MsgMultiTransferValue { 16 | 17 | @JsonProperty("from") 18 | @SerializedName("from") 19 | private String from; 20 | 21 | @JsonProperty("transfers") 22 | @SerializedName("transfers") 23 | private List transfers; 24 | 25 | public List getTransfers() { 26 | return transfers; 27 | } 28 | 29 | public void setTransfers(List transferUnits) { this.transfers = transferUnits; } 30 | 31 | public String getFrom() { 32 | return from; 33 | } 34 | 35 | public void setFrom(String from) { 36 | this.from = from; 37 | } 38 | 39 | @Override 40 | public String toString() { 41 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 42 | .append("from", from) 43 | .append("transfers", transfers) 44 | .toString(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/token/MsgTokenBurn.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.token; 2 | 3 | import com.okexchain.msg.MsgBase; 4 | import com.okexchain.msg.common.Message; 5 | import com.okexchain.msg.common.Token; 6 | import com.okexchain.utils.Utils; 7 | 8 | public class MsgTokenBurn extends MsgBase { 9 | 10 | public MsgTokenBurn() { setMsgType("okexchain/token/MsgBurn");} 11 | 12 | public Message produceTokenBurnMsg(String denom, String amountDenom, String owner) { 13 | 14 | Token amount = new Token(); 15 | amount.setDenom(denom); 16 | amount.setAmount(Utils.NewDecString(amountDenom)); 17 | 18 | MsgTokenBurnValue value = new MsgTokenBurnValue(); 19 | value.setAmount(amount); 20 | value.setOwner(owner); 21 | 22 | Message msg = new Message<>(); 23 | msg.setType(msgType); 24 | msg.setValue(value); 25 | 26 | return msg; 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/token/MsgTokenBurnValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.token; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import com.okexchain.msg.common.Token; 8 | import org.apache.commons.lang3.builder.ToStringBuilder; 9 | import org.apache.commons.lang3.builder.ToStringStyle; 10 | 11 | @JsonIgnoreProperties(ignoreUnknown = true) 12 | @JsonPropertyOrder(alphabetic = true) 13 | public class MsgTokenBurnValue { 14 | 15 | @JsonProperty("amount") 16 | @SerializedName("amount") 17 | private Token amount; 18 | 19 | @JsonProperty("owner") 20 | @SerializedName("owner") 21 | private String owner; 22 | 23 | public void setAmount(Token amount) {this.amount = amount;} 24 | 25 | public void setOwner(String owner) {this.owner = owner;} 26 | 27 | @Override 28 | public String toString() { 29 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 30 | .append("amount", amount) 31 | .append("owner", owner) 32 | .toString(); 33 | } 34 | 35 | } -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/token/MsgTokenMint.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.token; 2 | 3 | import com.okexchain.msg.MsgBase; 4 | import com.okexchain.msg.common.Message; 5 | import com.okexchain.msg.common.Token; 6 | import com.okexchain.utils.Utils; 7 | 8 | public class MsgTokenMint extends MsgBase { 9 | 10 | public MsgTokenMint() { setMsgType("okexchain/token/MsgMint");} 11 | 12 | public Message produceTokenMintMsg(String denom, String amountDenom, String owner) { 13 | 14 | Token amount = new Token(); 15 | amount.setDenom(denom); 16 | amount.setAmount(Utils.NewDecString(amountDenom)); 17 | 18 | MsgTokenMintValue value = new MsgTokenMintValue(); 19 | value.setAmount(amount); 20 | value.setOwner(owner); 21 | 22 | Message msg = new Message<>(); 23 | msg.setType(msgType); 24 | msg.setValue(value); 25 | 26 | return msg; 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/token/MsgTokenMintValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.token; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import com.google.gson.annotations.SerializedName; 5 | import com.okexchain.msg.common.Token; 6 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 7 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 8 | import org.apache.commons.lang3.builder.ToStringBuilder; 9 | import org.apache.commons.lang3.builder.ToStringStyle; 10 | 11 | @JsonIgnoreProperties(ignoreUnknown = true) 12 | @JsonPropertyOrder(alphabetic = true) 13 | public class MsgTokenMintValue { 14 | 15 | @JsonProperty("amount") 16 | @SerializedName("amount") 17 | private Token amount; 18 | 19 | @JsonProperty("owner") 20 | @SerializedName("owner") 21 | private String owner; 22 | 23 | public void setAmount(Token amount) {this.amount = amount;} 24 | 25 | public void setOwner(String owner) {this.owner = owner;} 26 | 27 | @Override 28 | public String toString() { 29 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 30 | .append("amount", amount) 31 | .append("owner", owner) 32 | .toString(); 33 | } 34 | 35 | } -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/token/MsgTokenModify.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.token; 2 | 3 | import com.okexchain.msg.MsgBase; 4 | import com.okexchain.msg.common.Message; 5 | 6 | public class MsgTokenModify extends MsgBase { 7 | 8 | public MsgTokenModify() { 9 | setMsgType("okexchain/token/MsgModify"); 10 | } 11 | 12 | public Message produceTokenModifyMsg (String description, boolean isDescEdit, String owner, String symbol, String wholeName, boolean isWholeNameEdit) { 13 | 14 | MsgTokenModifyValue value = new MsgTokenModifyValue(); 15 | value.setDescription(description); 16 | value.setDescriptionModified(isDescEdit); 17 | value.setOwner(owner); 18 | value.setSymbol(symbol); 19 | value.setWholeName(wholeName); 20 | value.setWholeNameModified(isWholeNameEdit); 21 | 22 | Message msg = new Message<>(); 23 | msg.setType(msgType); 24 | msg.setValue(value); 25 | return msg; 26 | 27 | } 28 | } -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/token/MsgTransferOwnership.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.token; 2 | 3 | import com.okexchain.msg.MsgBase; 4 | import com.okexchain.msg.common.Message; 5 | 6 | public class MsgTransferOwnership extends MsgBase { 7 | 8 | public MsgTransferOwnership() { setMsgType("okexchain/token/MsgTransferOwnership");} 9 | 10 | public Message produceTransferOwnerShipMsg(String fromAddress, String toAddress, String symbol) { 11 | 12 | MsgTransferOwnershipValue value = new MsgTransferOwnershipValue(); 13 | value.setFromAddress(fromAddress); 14 | value.setToAddress(toAddress); 15 | value.setSymbol(symbol); 16 | 17 | Message msg = new Message<>(); 18 | msg.setType(msgType); 19 | msg.setValue(value); 20 | 21 | return msg; 22 | } 23 | 24 | } -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/token/MsgTransferOwnershipValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.token; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 7 | import com.google.gson.annotations.SerializedName; 8 | import org.apache.commons.lang3.builder.ToStringBuilder; 9 | import org.apache.commons.lang3.builder.ToStringStyle; 10 | 11 | @JsonIgnoreProperties(ignoreUnknown = true) 12 | @JsonPropertyOrder(alphabetic = true) 13 | public class MsgTransferOwnershipValue { 14 | 15 | @JsonProperty("from_address") 16 | @SerializedName("from_address") 17 | private String fromAddress; 18 | 19 | @JsonProperty("symbol") 20 | @SerializedName("symbol") 21 | private String symbol; 22 | 23 | @JsonProperty("to_address") 24 | @SerializedName("to_address") 25 | private String toAddress; 26 | 27 | public void setFromAddress(String fromAddress) {this.fromAddress = fromAddress;} 28 | 29 | public void setToAddress(String toAddress) {this.toAddress = toAddress;} 30 | 31 | public void setSymbol(String symbol) {this.symbol = symbol;} 32 | 33 | @Override 34 | public String toString() { 35 | return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 36 | .append("from_address", fromAddress) 37 | .append("to_address", toAddress) 38 | .append("symbol", symbol) 39 | .toString(); 40 | } 41 | 42 | } -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/tx/Attribute.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.tx; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import com.google.gson.annotations.SerializedName; 5 | 6 | public class Attribute { 7 | @JsonProperty("key") 8 | @SerializedName("key") 9 | private String key; 10 | 11 | @JsonProperty("value") 12 | @SerializedName("value") 13 | private String value; 14 | 15 | public String getKey() { 16 | return key; 17 | } 18 | 19 | public String getValue() { 20 | return value; 21 | } 22 | 23 | public void setKey(String key) { 24 | this.key = key; 25 | } 26 | 27 | public void setValue(String value) { 28 | this.value = value; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/tx/BroadcastTx.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.tx; 2 | 3 | import com.fasterxml.jackson.core.JsonProcessingException; 4 | import com.fasterxml.jackson.databind.ObjectMapper; 5 | import com.okexchain.utils.Utils; 6 | import com.okexchain.msg.common.TxValue; 7 | 8 | import java.io.IOException; 9 | 10 | 11 | public class BroadcastTx { 12 | 13 | private String mode; 14 | private String type = "cosmos-sdk/StdTx"; 15 | private TxValue tx; 16 | 17 | private String nonce; 18 | 19 | public BroadcastTx() { 20 | } 21 | 22 | public TxValue getTx() { 23 | return tx; 24 | } 25 | 26 | public void setTx(TxValue value) { 27 | this.tx = value; 28 | } 29 | 30 | public String toJson() throws JsonProcessingException { 31 | return new ObjectMapper().writeValueAsString(this); 32 | } 33 | 34 | public String getMode() { 35 | return mode; 36 | } 37 | 38 | public void setMode(String mode) { 39 | this.mode = mode; 40 | } 41 | 42 | public void setNonce(String nonce) { 43 | this.nonce = nonce; 44 | } 45 | 46 | public String getNonce() { 47 | return this.nonce; 48 | } 49 | 50 | public static BroadcastTx fromJson(String json) throws IOException { 51 | return new ObjectMapper().readValue(json,BroadcastTx.class); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/tx/BroadcastValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.tx; 2 | 3 | import com.okexchain.msg.common.TxValue; 4 | import com.okexchain.utils.Utils; 5 | 6 | 7 | public class BroadcastValue { 8 | 9 | private String type = "cosmos-sdk/StdTx"; 10 | private TxValue value; 11 | 12 | public BroadcastValue() { 13 | } 14 | 15 | public TxValue getTx() { 16 | return value; 17 | } 18 | 19 | public void setTx(TxValue tx) { 20 | this.value = tx; 21 | } 22 | 23 | public String toJson() { 24 | return Utils.serializer.toJson(this); 25 | } 26 | 27 | public static BroadcastValue fromJson(String json) { 28 | return Utils.serializer.fromJson(json, BroadcastValue.class); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/tx/RawLog.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.tx; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | public class RawLog { 11 | 12 | public int getIndex() { 13 | return index; 14 | } 15 | 16 | public List getEvents() { 17 | return events; 18 | } 19 | 20 | public void setIndex(int index) { 21 | this.index = index; 22 | } 23 | 24 | public void setEvents(List events) { 25 | this.events = events; 26 | } 27 | 28 | @JsonProperty("msg_index") 29 | @SerializedName("msg_index") 30 | private int index; 31 | 32 | @JsonProperty("events") 33 | @SerializedName("events") 34 | private List events; 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/tx/StringEvent.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.tx; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import com.google.gson.annotations.SerializedName; 5 | 6 | import java.util.List; 7 | 8 | public class StringEvent { 9 | @JsonProperty("type") 10 | @SerializedName("type") 11 | private String type; 12 | 13 | @JsonProperty("attributes") 14 | @SerializedName("attributes") 15 | private List attributes; 16 | 17 | public String getType() { 18 | return type; 19 | } 20 | 21 | public List getAttributes() { 22 | return attributes; 23 | } 24 | 25 | public void setType(String type) { 26 | this.type = type; 27 | } 28 | 29 | public void setAttributes(List attributes) { 30 | this.attributes = attributes; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/wasm/Fund.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.wasm; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 7 | import com.google.gson.annotations.SerializedName; 8 | import lombok.AllArgsConstructor; 9 | import lombok.Data; 10 | import lombok.NoArgsConstructor; 11 | 12 | 13 | @Data 14 | @AllArgsConstructor 15 | @NoArgsConstructor 16 | @JsonIgnoreProperties(ignoreUnknown = true) 17 | @JsonPropertyOrder(alphabetic = true) 18 | public class Fund { 19 | 20 | @JsonProperty("amount") 21 | @SerializedName("amount") 22 | private String amount; 23 | 24 | @JsonProperty("denom") 25 | @SerializedName("denom") 26 | private String denom; 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/wasm/MsgClearAdminValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.wasm; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.google.gson.annotations.SerializedName; 7 | import lombok.AllArgsConstructor; 8 | import lombok.Data; 9 | import lombok.NoArgsConstructor; 10 | 11 | 12 | @Data 13 | @AllArgsConstructor 14 | @NoArgsConstructor 15 | @JsonIgnoreProperties(ignoreUnknown = true) 16 | @JsonPropertyOrder(alphabetic = true) 17 | public class MsgClearAdminValue { 18 | 19 | 20 | @JsonProperty("contract") 21 | @SerializedName("contract") 22 | private String contract; 23 | 24 | 25 | @JsonProperty("sender") 26 | @SerializedName("sender") 27 | private String sender; 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/wasm/MsgExecuteContractValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.wasm; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 7 | import com.google.gson.annotations.SerializedName; 8 | import lombok.AllArgsConstructor; 9 | import lombok.Data; 10 | import lombok.NoArgsConstructor; 11 | 12 | import java.util.List; 13 | 14 | 15 | @Data 16 | @AllArgsConstructor 17 | @NoArgsConstructor 18 | @JsonIgnoreProperties(ignoreUnknown = true) 19 | @JsonPropertyOrder(alphabetic = true) 20 | public class MsgExecuteContractValue { 21 | 22 | 23 | @JsonProperty("contract") 24 | @SerializedName("contract") 25 | private String contract; 26 | 27 | 28 | 29 | @JsonProperty("funds") 30 | @SerializedName("funds") 31 | private List fund; 32 | 33 | 34 | @JsonProperty("msg") 35 | @SerializedName("msg") 36 | private JSON msg; 37 | 38 | 39 | @JsonProperty("sender") 40 | @SerializedName("sender") 41 | private String sender; 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/wasm/MsgInstantiateContractValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.wasm; 2 | 3 | 4 | import com.alibaba.fastjson.JSON; 5 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 8 | import com.google.gson.annotations.SerializedName; 9 | import lombok.AllArgsConstructor; 10 | import lombok.Data; 11 | import lombok.NoArgsConstructor; 12 | 13 | import java.util.List; 14 | 15 | 16 | @Data 17 | @AllArgsConstructor 18 | @NoArgsConstructor 19 | @JsonIgnoreProperties(ignoreUnknown = true) 20 | @JsonPropertyOrder(alphabetic = true) 21 | public class MsgInstantiateContractValue { 22 | 23 | 24 | @JsonProperty("admin") 25 | @SerializedName("admin") 26 | private String admin; 27 | 28 | @JsonProperty("code_id") 29 | @SerializedName("code_id") 30 | private String codeId; 31 | 32 | @JsonProperty("funds") 33 | @SerializedName("funds") 34 | private List fund; 35 | 36 | @JsonProperty("label") 37 | @SerializedName("label") 38 | private String label; 39 | 40 | @JsonProperty("msg") 41 | @SerializedName("msg") 42 | private JSON msg; 43 | 44 | @JsonProperty("sender") 45 | @SerializedName("sender") 46 | private String sender; 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/wasm/MsgMigrateContractValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.wasm; 2 | 3 | 4 | import com.alibaba.fastjson.JSON; 5 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 8 | import com.google.gson.annotations.SerializedName; 9 | import lombok.AllArgsConstructor; 10 | import lombok.Data; 11 | import lombok.NoArgsConstructor; 12 | 13 | @Data 14 | @AllArgsConstructor 15 | @NoArgsConstructor 16 | @JsonIgnoreProperties(ignoreUnknown = true) 17 | @JsonPropertyOrder(alphabetic = true) 18 | public class MsgMigrateContractValue { 19 | 20 | @JsonProperty("code_id") 21 | @SerializedName("code_id") 22 | private String codeId; 23 | 24 | @JsonProperty("contract") 25 | @SerializedName("contract") 26 | private String contract; 27 | 28 | @JsonProperty("msg") 29 | @SerializedName("msg") 30 | private JSON msg; 31 | 32 | @JsonProperty("sender") 33 | @SerializedName("sender") 34 | private String sender; 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/wasm/MsgStoreCodeValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.wasm; 2 | 3 | 4 | 5 | import com.alibaba.fastjson.JSON; 6 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 9 | import com.google.gson.JsonParser; 10 | import com.google.gson.annotations.SerializedName; 11 | import lombok.AllArgsConstructor; 12 | import lombok.Data; 13 | import lombok.NoArgsConstructor; 14 | 15 | @Data 16 | @AllArgsConstructor 17 | @NoArgsConstructor 18 | @JsonIgnoreProperties(ignoreUnknown = true) 19 | @JsonPropertyOrder(alphabetic = true) 20 | public class MsgStoreCodeValue { 21 | 22 | 23 | @JsonProperty("instantiate_permission") 24 | @SerializedName("instantiate_permission") 25 | private JSON instantiatePermission; 26 | 27 | @JsonProperty("sender") 28 | @SerializedName("sender") 29 | private String sender; 30 | 31 | @JsonProperty("wasm_byte_code") 32 | @SerializedName("wasm_byte_code") 33 | private String wasmByteCode; 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/wasm/MsgUpdateAdminValue.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.wasm; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 7 | import com.google.gson.annotations.SerializedName; 8 | import lombok.AllArgsConstructor; 9 | import lombok.Data; 10 | import lombok.NoArgsConstructor; 11 | 12 | @Data 13 | @AllArgsConstructor 14 | @NoArgsConstructor 15 | @JsonIgnoreProperties(ignoreUnknown = true) 16 | @JsonPropertyOrder(alphabetic = true) 17 | public class MsgUpdateAdminValue { 18 | 19 | 20 | @JsonProperty("new_admin") 21 | @SerializedName("new_admin") 22 | private String newAdmin; 23 | 24 | 25 | @JsonProperty("sender") 26 | @SerializedName("sender") 27 | private String sender; 28 | 29 | @JsonProperty("contract") 30 | @SerializedName("contract") 31 | private String contract; 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/wasm/burner.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/okx/exchain-java-sdk/b70bde01c4642de11a72d9d048eea5261e12ced0/src/main/java/com/okexchain/msg/wasm/burner.wasm -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/wasm/cw20_base.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/okx/exchain-java-sdk/b70bde01c4642de11a72d9d048eea5261e12ced0/src/main/java/com/okexchain/msg/wasm/cw20_base.wasm -------------------------------------------------------------------------------- /src/main/java/com/okexchain/msg/wasm/hackatom.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/okx/exchain-java-sdk/b70bde01c4642de11a72d9d048eea5261e12ced0/src/main/java/com/okexchain/msg/wasm/hackatom.wasm -------------------------------------------------------------------------------- /src/main/java/com/okexchain/sample/EthAddress.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.sample; 2 | 3 | import com.okexchain.utils.crypto.AddressUtil; 4 | import com.okexchain.utils.crypto.Crypto; 5 | import com.okexchain.utils.crypto.PrivateKey; 6 | import org.bouncycastle.util.encoders.Hex; 7 | import org.web3j.crypto.*; 8 | import java.math.BigInteger; 9 | import java.security.Key; 10 | import java.security.SignatureException; 11 | 12 | public class EthAddress { 13 | 14 | public static void main(String[] args) throws Exception { 15 | TestcreateNewAddressSecp256k1(); 16 | TestConvertAddress(); 17 | } 18 | 19 | public static void TestcreateNewAddressSecp256k1() throws Exception { 20 | PrivateKey key = new PrivateKey( "4412948D29D5433F4A6F07DE88BFB6411DB87B7F40AFF81E29F1EE12A2E8210D"); 21 | String priKey = key.getPriKey(); 22 | 23 | String addr = AddressUtil.createNewAddressSecp256k1("okexchain", Hex.decode(key.getPubKey())); 24 | System.out.println("address is : " + addr); 25 | } 26 | 27 | public static void TestConvertAddress() throws Exception { 28 | String ethAddr = AddressUtil.convertAddressFromBech32ToHex("okexchain1w739u0j5gngjlh5v2w7fnnj9tf2vu44m3qy6xy"); 29 | System.out.println("ethAddr is : " + ethAddr); 30 | 31 | String bech32Addr = AddressUtil.convertAddressFromHexToBech32("0x77A25E3e5444d12fde8C53BC99CE455A54ce56bb"); 32 | System.out.println("bech32Addr is : " + bech32Addr); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/sample/FeesplitQuerySample.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.sample; 2 | 3 | import com.okexchain.env.EnvInstance; 4 | import com.okexchain.msg.feesplit.FeesplitQuery; 5 | import lombok.extern.slf4j.Slf4j; 6 | 7 | @Slf4j 8 | public class FeesplitQuerySample { 9 | 10 | public static void main(String[] args) { 11 | EnvInstance.getEnvTestNet(); 12 | System.out.println(FeesplitQuery.queryFeesplitInfoByContractAddr("0x95d85EC4003A349c05107A0362e846Ca157194A0")); 13 | System.out.println(FeesplitQuery.queryContractAddrByWithdrawerAddr("ex17d7yg0n5uhqtke865c9t0rehmkjg736c7j47as",1,2)); 14 | System.out.println(FeesplitQuery.queryContractAddrBydeployerAddr("ex1v8segh8mlw297s2ksy6pp6nwxn3el0wmkuqsx2",1,2)); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/sample/Gentx.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.sample; 2 | 3 | import com.okexchain.msg.MsgBase; 4 | import com.okexchain.msg.staking.MsgCreateValidator; 5 | import com.okexchain.msg.common.Message; 6 | import com.okexchain.msg.common.Signature; 7 | import com.okexchain.msg.tx.BroadcastValue; 8 | import com.okexchain.msg.tx.UnsignedTx; 9 | import com.okexchain.utils.crypto.PrivateKey; 10 | 11 | public class Gentx { 12 | public static void main(String[] args) { 13 | PrivateKey key = new PrivateKey("b4083733cd8379f1249cb9431a074e495a64ae003273d31a7e58356eaad8a0cf"); 14 | 15 | MsgCreateValidator msg = new MsgCreateValidator(); 16 | System.out.println(key.getPubKey()); 17 | msg.init(key.getPubKey(),"0","0"); 18 | 19 | Message messages = msg.produceMsg( 20 | "okexchainvalconspub1zcjduepqtv2yy90ptjegdm34vfhlq2uw9eu39hjrt98sffj7yghl4s47xv7svt56mk", 21 | "val0","","","", "10000.00000000"); 22 | 23 | try { 24 | UnsignedTx unsignedTx = msg.getUnsignedTx(messages,"", "200000", ""); 25 | Signature signature = MsgBase.signTx(unsignedTx.toString(), key.getPriKey()); 26 | BroadcastValue signedTx = unsignedTx.sign4gentx(signature); 27 | 28 | System.out.println("======= gentx json ========="); 29 | System.out.println(signedTx.toJson()); 30 | 31 | } catch (Exception e) { 32 | System.out.println("serialize transfer msg failed"); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/sample/IbcTransfer.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.sample; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.fasterxml.jackson.core.JsonProcessingException; 5 | import com.okexchain.env.EnvBase; 6 | import com.okexchain.env.EnvInstance; 7 | import com.okexchain.msg.common.Message; 8 | import com.okexchain.msg.common.TimeoutHeight; 9 | import com.okexchain.msg.ibc.TransferMsg; 10 | 11 | public class IbcTransfer { 12 | 13 | 14 | public static void main(String[] args) throws JsonProcessingException { 15 | EnvBase env = EnvInstance.getEnv(); 16 | env.setChainID("exchain-101"); 17 | // env.setTxUrlPath("/cosmos/tx/v1beta1/txs"); 18 | env.setRestServerUrl("http://127.0.0.1:36659"); 19 | env.setRestPathPrefix("/exchain/v1"); 20 | env.setTxUrlPath("/exchain/v1/txs"); 21 | testIbcTransfer(); 22 | } 23 | 24 | 25 | static void testIbcTransfer() { 26 | TransferMsg msg = new TransferMsg(); 27 | msg.initMnemonic("giggle sibling fun arrow elevator spoon blood grocery laugh tortoise culture tool"); 28 | 29 | 30 | Message messages = msg.produceMsg("channel-0","2000000000000000000000", "cosmos1n064mg7jcxt2axur29mmek5ys7ghta4u4mhcjp", new TimeoutHeight("1","200000")); 31 | 32 | try { 33 | JSONObject result = msg.submit(messages, "0.03", "2000000", ""); 34 | System.out.println(result.toJSONString()); 35 | } catch (Exception e) { 36 | System.out.println("serialize transfer msg failed"); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/sample/WasmQuerySample.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.sample; 2 | 3 | import com.okexchain.env.EnvInstance; 4 | import com.okexchain.msg.wasm.WasmQuery; 5 | 6 | import java.io.UnsupportedEncodingException; 7 | 8 | public class WasmQuerySample { 9 | 10 | public static void main(String[] args) throws UnsupportedEncodingException { 11 | EnvInstance.getEnvLocalNet(); 12 | // System.out.println(WasmQuery.queryListCode()); 13 | // System.out.println(WasmQuery.queryListContractsByCodeID("1")); 14 | // System.out.println(WasmQuery.queryCodeByCodeID("1")); 15 | System.out.println(WasmQuery.queryContractByContractAddr("ex14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s6fqu27")); 16 | // System.out.println(WasmQuery.queryContractHistoryByContractAddr("ex1xt4ahzz2x8hpkc0tk6ekte9x6crw4w6u0r67cyt3kz9syh24pd7spvs7pk")); 17 | // System.out.println(WasmQuery.queryContractStateAllByContractAddr("ex1xt4ahzz2x8hpkc0tk6ekte9x6crw4w6u0r67cyt3kz9syh24pd7spvs7pk")); 18 | // System.out.println(WasmQuery.queryContractStateSmart("ex1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsnw8alf","{\"verifier\":{}}")); 19 | // System.out.println(WasmQuery.queryContractStateRaw("ex1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsnw8alf","config")); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/utils/SuccessRespon.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.utils; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | public class SuccessRespon { 6 | public String status; 7 | @SerializedName("data") 8 | public T dataObject; 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/utils/crypto/PrivateKey.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.utils.crypto; 2 | 3 | import org.bouncycastle.util.encoders.Hex; 4 | 5 | public class PrivateKey { 6 | 7 | protected String pubKeyString; 8 | protected String address; 9 | protected String priKeyString; 10 | 11 | public PrivateKey(String mnemonic) { 12 | if (mnemonic.indexOf(' ') >= 0) { 13 | priKeyString = Crypto.generatePrivateKeyFromMnemonic(mnemonic); 14 | } else { 15 | priKeyString = mnemonic; 16 | } 17 | 18 | pubKeyString = Hex.toHexString(Crypto.generatePubKeyFromPriv(priKeyString)); 19 | address = Crypto.generateAddressFromPriv(priKeyString); 20 | } 21 | 22 | public String getAddress() { 23 | return address; 24 | } 25 | 26 | public String getPubKey() { 27 | return pubKeyString; 28 | } 29 | 30 | public String getPriKey() { 31 | return priKeyString; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/utils/encoding/message/MessageType.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.utils.encoding.message; 2 | 3 | import com.okexchain.utils.encoding.EncodeUtils; 4 | 5 | public enum MessageType { 6 | BaseType(null), 7 | Send("5605A9BA"), 8 | MultiSend("D6B821E4"), 9 | MultiNewOrder("66A24314"), 10 | MultiCancelOrder("5B043F67"), 11 | PubKey("EB5AE987"), 12 | StdTx("282816A9"); 13 | 14 | private byte[] typePrefixBytes; 15 | 16 | MessageType(String typePrefix) { 17 | if (typePrefix == null) { 18 | this.typePrefixBytes = new byte[0]; 19 | } else 20 | this.typePrefixBytes = EncodeUtils.hexStringToByteArray(typePrefix); 21 | } 22 | 23 | public byte[] getTypePrefixBytes() { 24 | return typePrefixBytes; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/utils/exception/BadURLException.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.utils.exception; 2 | 3 | /** 4 | * BadURLException wraps errors due to malformed URLs. 5 | */ 6 | public class BadURLException extends CosmosException { 7 | /** 8 | * Initializes exception with its message attribute. 9 | * @param message error message 10 | */ 11 | public BadURLException(String message) { 12 | super(message); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/utils/exception/BuildException.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.utils.exception; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * BuildException wraps errors returned by the build-transaction endpoint. 9 | */ 10 | public class BuildException extends APIException { 11 | 12 | public BuildException(String message, String requestId) { 13 | super(message, requestId); 14 | } 15 | 16 | public static class ActionError extends APIException { 17 | 18 | public static class Data { 19 | /** 20 | * The index of the action that caused this error. 21 | */ 22 | @SerializedName("index") 23 | public Integer index; 24 | } 25 | 26 | public ActionError(String message, String requestId) { 27 | super(message, requestId); 28 | } 29 | 30 | /** 31 | * Additional data pertaining to the error. 32 | */ 33 | public Data data; 34 | } 35 | 36 | public static class Data { 37 | /** 38 | * A list of errors resulting from building actions. 39 | */ 40 | @SerializedName("actions") 41 | public List actionErrors; 42 | } 43 | 44 | /** 45 | * Extra data associated with this error, if any. 46 | */ 47 | @SerializedName("data") 48 | public Data data; 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/utils/exception/ConfigurationException.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.utils.exception; 2 | 3 | /** 4 | * ConfigurationException wraps errors during client configuration. 5 | */ 6 | public class ConfigurationException extends CosmosException { 7 | /** 8 | * Initializes exception with its message attribute. 9 | * @param message error message 10 | */ 11 | public ConfigurationException(String message) { 12 | super(message); 13 | } 14 | 15 | /** 16 | * Initializes new exception while storing original cause. 17 | * @param message the error message 18 | * @param cause the original cause 19 | */ 20 | public ConfigurationException(String message, Throwable cause) { 21 | super(message, cause); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/utils/exception/ConnectivityException.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.utils.exception; 2 | 3 | import com.squareup.okhttp.Response; 4 | 5 | import java.io.IOException; 6 | 7 | /** 8 | * ConnectivityException wraps errors due to connectivity issues with the server. 9 | */ 10 | public class ConnectivityException extends CosmosException { 11 | /** 12 | * Initializes exception with its message attribute. 13 | * @param resp the server response used to create error message 14 | */ 15 | public ConnectivityException(Response resp) { 16 | super(formatMessage(resp)); 17 | } 18 | 19 | /** 20 | * Parses the the server response into a detailed error message. 21 | * @param resp the server response 22 | * @return detailed error message 23 | */ 24 | private static String formatMessage(Response resp) { 25 | String s = 26 | "Response HTTP header field Chain-Request-ID is unset. There may be network issues. Please check your local network settings."; 27 | // TODO(kr): include client-generated reqid here once we have that. 28 | String body; 29 | try { 30 | body = resp.body().string(); 31 | } catch (IOException ex) { 32 | body = "[unable to read response body: " + ex.toString() + "]"; 33 | } 34 | return String.format("%s status=%d body=%s", s, resp.code(), body); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/utils/exception/CosmosException.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.utils.exception; 2 | 3 | /** 4 | * Base exception class for the Chain Core SDK. 5 | */ 6 | public class CosmosException extends Exception { 7 | /** 8 | * Default constructor. 9 | */ 10 | public CosmosException() { 11 | super(); 12 | } 13 | 14 | /** 15 | * Initializes exception with its message attribute. 16 | * 17 | * @param message error message 18 | */ 19 | public CosmosException(String message) { 20 | super(message); 21 | } 22 | 23 | /** 24 | * Initializes a new exception while storing the original cause. 25 | * 26 | * @param message the error message 27 | * @param cause the cause of the exception 28 | */ 29 | public CosmosException(String message, Throwable cause) { 30 | super(message, cause); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/utils/exception/HTTPException.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.utils.exception; 2 | 3 | /** 4 | * HTTPException wraps generic HTTP errors. 5 | */ 6 | public class HTTPException extends CosmosException { 7 | /** 8 | * Initializes exception with its message attribute. 9 | * @param message error message 10 | */ 11 | public HTTPException(String message) { 12 | super(message); 13 | } 14 | 15 | /** 16 | * Initializes new exception while storing original cause. 17 | * @param message the error message 18 | * @param cause the original cause 19 | */ 20 | public HTTPException(String message, Throwable cause) { 21 | super(message, cause); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/okexchain/utils/exception/JSONException.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.utils.exception; 2 | 3 | /** 4 | * JSONException wraps errors due to marshaling/unmarshaling json payloads. 5 | */ 6 | public class JSONException extends CosmosException { 7 | 8 | /** 9 | * Unique indentifier of the request to the server. 10 | */ 11 | public String requestId; 12 | 13 | /** 14 | * Default constructor. 15 | */ 16 | public JSONException(String message) { 17 | super(message); 18 | } 19 | 20 | /** 21 | * Initializes exception with its message and requestId attributes. 22 | * Use this constructor in context of an API call. 23 | * 24 | * @param message error message 25 | * @param requestId unique identifier of the request 26 | */ 27 | public JSONException(String message, String requestId) { 28 | super(message); 29 | this.requestId = requestId; 30 | } 31 | 32 | public String getMessage() { 33 | String message = "Message: " + super.getMessage(); 34 | if (requestId != null) { 35 | message += " Request-ID: " + requestId; 36 | } 37 | return message; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/resources/config.properties: -------------------------------------------------------------------------------- 1 | bytom.api.url= 2 | client.access.token= 3 | 4 | # bytom.api.url=http://10.100.7.47:9888/ 5 | # client.access.token=wt:3d17dbb953cedd53353bf3f342bb2929e9505105ffeb21670e6bd00abeef3772 6 | 7 | #bytom.api.url=http://127.0.0.1:9888/ 8 | #client.access.token=sheng:49d1623f5991c62a5094e761477ddd2838dceb49c22fbf84b492a54f1df88123 9 | -------------------------------------------------------------------------------- /src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootLogger=debug, stdout, R 2 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 3 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 4 | 5 | log4j.logger.org.apache.commons.httpclient=info 6 | log4j.logger.httpclient.wire.content=info 7 | log4j.logger.httpclient.wire.header=info 8 | log4j.logger.org.apache.http=info 9 | log4j.logger.org.apache.http.wire=info 10 | 11 | # Pattern to output the caller's file name and line number. 12 | log4j.appender.stdout.layout.ConversionPattern=%-4r %-5p [%d{yyyy-MM-dd HH:mm:ss}] %m%n 13 | 14 | log4j.appender.R=org.apache.log4j.RollingFileAppender 15 | log4j.appender.R.File=bytom.log 16 | log4j.appender.R.MaxFileSize= 1000KB 17 | 18 | # Keep one backup file 19 | log4j.appender.R.MaxBackupIndex=1 20 | 21 | log4j.appender.R.layout=org.apache.log4j.PatternLayout 22 | log4j.appender.R.layout.ConversionPattern=%-4r %-5p [%d{yyyy-MM-dd HH:mm:ss}] %m%n -------------------------------------------------------------------------------- /src/test/java/com/ibc/erc20/MsgClientUpdateProposalTest.java: -------------------------------------------------------------------------------- 1 | package com.ibc.erc20; 2 | 3 | 4 | import com.alibaba.fastjson.JSONObject; 5 | import com.okexchain.env.EnvInstance; 6 | import com.okexchain.msg.common.Message; 7 | import com.okexchain.msg.gov.MsgClientUpdateProposal; 8 | import com.okexchain.msg.gov.MsgClientUpdateProposalValue; 9 | import com.okexchain.utils.crypto.PrivateKey; 10 | import lombok.extern.slf4j.Slf4j; 11 | import org.junit.Test; 12 | 13 | @Slf4j 14 | public class MsgClientUpdateProposalTest { 15 | 16 | @Test 17 | public void testProduceClientUpdateProposal(){ 18 | EnvInstance.getEnvTestNet(); 19 | MsgClientUpdateProposal msg=new MsgClientUpdateProposal(); 20 | msg.init(new PrivateKey("")); 21 | 22 | MsgClientUpdateProposalValue value=new MsgClientUpdateProposalValue(); 23 | value.setTitle("title"); 24 | value.setDescription("des"); 25 | value.setSubjectClientId("07-tendermint-0"); 26 | value.setSubstituteClientId("07-tendermint-1"); 27 | 28 | Message message=msg.produceClientUpdateProposal(value,"okt","20.000000000000000000"); 29 | JSONObject res = msg.submit(message, "0.03", "20000000", ""); 30 | System.out.println(res.toJSONString()); 31 | try { 32 | boolean succeed = msg.isTxSucceed(res); 33 | System.out.println("tx " + (succeed ? "succeed": "failed")); 34 | } catch (Exception e) { 35 | System.out.println(e); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/test/java/com/ibc/erc20/MsgTokenMappingProposalTest.java: -------------------------------------------------------------------------------- 1 | package com.ibc.erc20; 2 | 3 | 4 | import com.alibaba.fastjson.JSONObject; 5 | import com.okexchain.env.EnvInstance; 6 | import com.okexchain.msg.common.Message; 7 | import com.okexchain.msg.gov.MsgTokenMappingProposal; 8 | import com.okexchain.msg.gov.MsgTokenMappingProposalValue; 9 | import com.okexchain.utils.crypto.PrivateKey; 10 | import lombok.extern.slf4j.Slf4j; 11 | import org.junit.Test; 12 | @Slf4j 13 | public class MsgTokenMappingProposalTest { 14 | 15 | 16 | @Test 17 | public void testProduceTokenMappingProposal(){ 18 | EnvInstance.getEnvTestNet(); 19 | MsgTokenMappingProposal msg=new MsgTokenMappingProposal(); 20 | msg.init(new PrivateKey("")); 21 | MsgTokenMappingProposalValue proposal=new MsgTokenMappingProposalValue(); 22 | proposal.setTitle("test"); 23 | proposal.setDescription("test"); 24 | proposal.setDenom("ibc/34343"); 25 | proposal.setContract("0x2Bd4AF0C1D0c2930fEE852D07bB9dE87D8C07044"); 26 | Message message=msg.produceTokenMappingProposal(proposal,"okt","0.050000000000000000"); 27 | JSONObject res = msg.submit(message, "0.03", "2000000", ""); 28 | System.out.println(res.toJSONString()); 29 | try { 30 | boolean succeed = msg.isTxSucceed(res); 31 | System.out.println("tx " + (succeed ? "succeed": "failed")); 32 | } catch (Exception e) { 33 | System.out.println(e); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/test/java/com/okc/ibc/HeightTest.java: -------------------------------------------------------------------------------- 1 | package com.okc.ibc; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.junit.Test; 5 | 6 | @Slf4j 7 | public class HeightTest { 8 | 9 | @Test 10 | public void height(){ 11 | 12 | 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/test/java/com/okc/staking/MsgRewardTruncatePrecisionProposalTest.java: -------------------------------------------------------------------------------- 1 | package com.okc.staking; 2 | 3 | 4 | import com.alibaba.fastjson.JSONObject; 5 | import com.okexchain.env.EnvInstance; 6 | import com.okexchain.msg.common.Message; 7 | import com.okexchain.msg.gov.MsgRewardTruncatePrecisionProposal; 8 | import com.okexchain.msg.gov.MsgRewardTruncatePrecisionProposalValue; 9 | import lombok.extern.slf4j.Slf4j; 10 | import org.junit.Test; 11 | 12 | @Slf4j 13 | public class MsgRewardTruncatePrecisionProposalTest { 14 | 15 | //https://www.oklink.com/zh-cn/okc-test/tx/0x4B4FED343AE0106DD79AFFC7B47FB567F86423CB3D758801C4650709043C1923 16 | @Test 17 | public void testMsgRewardTruncatePrecisionProposal(){ 18 | 19 | MsgRewardTruncatePrecisionProposal msg=new MsgRewardTruncatePrecisionProposal(); 20 | EnvInstance.getEnvTestNet(); 21 | msg.initMnemonic(""); 22 | Message message=msg.produceMsgRewardTruncatePrecisionProposal("test RewardTruncatePrecisionProposal","desc",1,"okt","10.000000000000000000"); 23 | JSONObject res = msg.submit(message, "0.03", "20000000", ""); 24 | System.out.println(res.toJSONString()); 25 | try { 26 | boolean succeed = msg.isTxSucceed(res); 27 | System.out.println("tx " + (succeed ? "succeed": "failed")); 28 | } catch (Exception e) { 29 | System.out.println(e); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/test/java/com/okexchain/msg/gov/MsgManageContractBytecodeProposalTest.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.gov; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.okexchain.env.EnvBase; 5 | import com.okexchain.env.EnvInstance; 6 | import com.okexchain.msg.common.Message; 7 | import org.junit.Test; 8 | 9 | public class MsgManageContractBytecodeProposalTest{ 10 | @Test 11 | public void testProposal() { 12 | EnvBase env = EnvInstance.getEnvLocalNet(); 13 | 14 | MsgManageContractBytecodeProposal msg = new MsgManageContractBytecodeProposal(); 15 | msg.initMnemonic(""); 16 | 17 | try { 18 | Message message = msg.produceMsgManageContractBytecodeProposal( 19 | "update contract bytecode", 20 | "update contract bytecode", 21 | "0xFc0b06f1C1e82eFAdC0E5c226616B092D2cb97fF", 22 | "0x2594E83A94F89Ffb923773ddDfF723BbE017b80D", 23 | "okt", 24 | "10"); 25 | JSONObject res = msg.submit(message, "0.05000000", "500000", ""); 26 | System.out.println(res.toString()); 27 | boolean succeed = msg.isTxSucceed(res); 28 | System.out.println("tx " + (succeed ? "succeed" : "failed")); 29 | } catch (Exception e) { 30 | System.out.println(e); 31 | } 32 | } 33 | 34 | } -------------------------------------------------------------------------------- /src/test/java/com/okexchain/msg/gov/MsgModifyNextBlockUpdateProposalTest.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.gov; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.okexchain.env.EnvBase; 5 | import com.okexchain.env.EnvInstance; 6 | import com.okexchain.msg.common.Message; 7 | import org.junit.Test; 8 | 9 | public class MsgModifyNextBlockUpdateProposalTest{ 10 | 11 | @Test 12 | public void testSubmitProposal() { 13 | EnvBase env = EnvInstance.getEnvLocalNet(); 14 | try { 15 | 16 | MsgModifyNextBlockUpdateProposal.ProposalValue proposalValue = new MsgModifyNextBlockUpdateProposal.ProposalValue("ModifyNextBlock", "ModifyNextBlock","10002"); 17 | MsgModifyNextBlockUpdateProposal proposal = new MsgModifyNextBlockUpdateProposal(proposalValue); 18 | proposal.initMnemonic(""); 19 | Message message = proposal.buildMessage("okt","10"); 20 | JSONObject res = proposal.submit(message, "0.05000000", "500000", ""); 21 | System.out.println(res.toString()); 22 | boolean succeed = proposal.isTxSucceed(res); 23 | System.out.println("tx " + (succeed ? "succeed" : "failed")); 24 | } catch (Exception e) { 25 | e.printStackTrace(); 26 | } 27 | 28 | 29 | } 30 | 31 | } -------------------------------------------------------------------------------- /src/test/java/com/okexchain/msg/gov/MsgUpgradeProposalTest.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.msg.gov; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.okexchain.env.EnvBase; 5 | import com.okexchain.env.EnvInstance; 6 | import com.okexchain.msg.common.Message; 7 | import junit.framework.TestCase; 8 | import org.junit.Test; 9 | 10 | public class MsgUpgradeProposalTest { 11 | 12 | @Test 13 | public void testProposal() { 14 | EnvBase env = EnvInstance.getEnvTestNet(); 15 | env.setRestServerUrl("http://18.178.135.201:26659"); 16 | env.setRestPathPrefix("/exchain/v1"); 17 | env.setTxUrlPath("/exchain/v1/txs"); 18 | // EnvBase envBase = EnvInstance.getEnvLocalNet(); 19 | try { 20 | MsgUpgradeProposal.ProposalValue proposalValue = new MsgUpgradeProposal.ProposalValue("upgradeProposalTest","upgrade","UnvoteTest10","20049719",null); 21 | MsgUpgradeProposal proposal = new MsgUpgradeProposal(proposalValue); 22 | proposal.initMnemonic("tree allow unlock rug enact senior laundry aunt festival lab jungle ill"); 23 | Message message = proposal.buildMessage("okt","10"); 24 | JSONObject res = proposal.submit(message, "0.05000000", "500000", ""); 25 | System.out.println(res.toString()); 26 | boolean succeed = proposal.isTxSucceed(res); 27 | System.out.println("tx " + (succeed ? "succeed" : "failed")); 28 | } catch (Exception e) { 29 | e.printStackTrace(); 30 | } 31 | } 32 | 33 | } -------------------------------------------------------------------------------- /src/test/java/com/okexchain/utils/UtilsTest.java: -------------------------------------------------------------------------------- 1 | package com.okexchain.utils; 2 | 3 | import junit.framework.TestCase; 4 | import org.junit.Assert; 5 | 6 | public class UtilsTest extends TestCase { 7 | 8 | public void testIsValidHexAddress() { 9 | String hexAddress = "0x45dD91b0289E60D89Cec94dF0Aac3a2f539c514a"; 10 | Assert.assertTrue(Utils.isValidHexAddress(hexAddress)); 11 | 12 | hexAddress = "45dD91b0289E60D89Cec94dF0Aac3a2f539c514a"; 13 | Assert.assertFalse(Utils.isValidHexAddress(hexAddress)); 14 | 15 | hexAddress = "0x45dD91b09E60D89Cec94dF0Aac3a2f539c514a"; 16 | Assert.assertFalse(Utils.isValidHexAddress(hexAddress)); 17 | } 18 | } --------------------------------------------------------------------------------