|
11 | 11 | from pyinjective.core.market import BinaryOptionMarket, DerivativeMarket, SpotMarket |
12 | 12 | from pyinjective.core.token import Token |
13 | 13 | from pyinjective.proto.cosmos.authz.v1beta1 import authz_pb2 as cosmos_authz_pb, tx_pb2 as cosmos_authz_tx_pb |
14 | | -from pyinjective.proto.cosmos.bank.v1beta1 import tx_pb2 as cosmos_bank_tx_pb |
| 14 | +from pyinjective.proto.cosmos.bank.v1beta1 import bank_pb2 as bank_pb, tx_pb2 as cosmos_bank_tx_pb |
15 | 15 | from pyinjective.proto.cosmos.base.v1beta1 import coin_pb2 as cosmos_dot_base_dot_v1beta1_dot_coin__pb2 |
16 | 16 | from pyinjective.proto.cosmos.distribution.v1beta1 import tx_pb2 as cosmos_distribution_tx_pb |
17 | 17 | from pyinjective.proto.cosmos.gov.v1beta1 import tx_pb2 as cosmos_gov_tx_pb |
|
28 | 28 | from pyinjective.proto.injective.oracle.v1beta1 import tx_pb2 as injective_oracle_tx_pb |
29 | 29 | from pyinjective.proto.injective.peggy.v1 import msgs_pb2 as injective_peggy_tx_pb |
30 | 30 | from pyinjective.proto.injective.stream.v1beta1 import query_pb2 as chain_stream_query |
| 31 | +from pyinjective.proto.injective.tokenfactory.v1beta1 import ( |
| 32 | + params_pb2 as token_factory_params_pb, |
| 33 | + tx_pb2 as token_factory_tx_pb, |
| 34 | +) |
31 | 35 |
|
32 | 36 | REQUEST_TO_RESPONSE_TYPE_MAP = { |
33 | 37 | "MsgCreateSpotLimitOrder": injective_exchange_tx_pb.MsgCreateSpotLimitOrderResponse, |
@@ -957,6 +961,95 @@ def MsgInstantiateContract( |
957 | 961 | # The coins in the list must be sorted in alphabetical order by denoms. |
958 | 962 | ) |
959 | 963 |
|
| 964 | + def msg_create_denom( |
| 965 | + self, |
| 966 | + sender: str, |
| 967 | + subdenom: str, |
| 968 | + name: str, |
| 969 | + symbol: str, |
| 970 | + ) -> token_factory_tx_pb.MsgCreateDenom: |
| 971 | + return token_factory_tx_pb.MsgCreateDenom( |
| 972 | + sender=sender, |
| 973 | + subdenom=subdenom, |
| 974 | + name=name, |
| 975 | + symbol=symbol, |
| 976 | + ) |
| 977 | + |
| 978 | + def msg_mint( |
| 979 | + self, |
| 980 | + sender: str, |
| 981 | + amount: cosmos_dot_base_dot_v1beta1_dot_coin__pb2.Coin, |
| 982 | + ) -> token_factory_tx_pb.MsgMint: |
| 983 | + return token_factory_tx_pb.MsgMint(sender=sender, amount=amount) |
| 984 | + |
| 985 | + def msg_burn( |
| 986 | + self, |
| 987 | + sender: str, |
| 988 | + amount: cosmos_dot_base_dot_v1beta1_dot_coin__pb2.Coin, |
| 989 | + ) -> token_factory_tx_pb.MsgBurn: |
| 990 | + return token_factory_tx_pb.MsgBurn(sender=sender, amount=amount) |
| 991 | + |
| 992 | + def msg_set_denom_metadata( |
| 993 | + self, |
| 994 | + sender: str, |
| 995 | + description: str, |
| 996 | + denom: str, |
| 997 | + subdenom: str, |
| 998 | + token_decimals: int, |
| 999 | + name: str, |
| 1000 | + symbol: str, |
| 1001 | + uri: str, |
| 1002 | + uri_hash: str, |
| 1003 | + ) -> token_factory_tx_pb.MsgSetDenomMetadata: |
| 1004 | + micro_denom_unit = bank_pb.DenomUnit( |
| 1005 | + denom=denom, |
| 1006 | + exponent=0, |
| 1007 | + aliases=[f"micro{subdenom}"], |
| 1008 | + ) |
| 1009 | + denom_unit = bank_pb.DenomUnit( |
| 1010 | + denom=subdenom, |
| 1011 | + exponent=token_decimals, |
| 1012 | + aliases=[subdenom], |
| 1013 | + ) |
| 1014 | + metadata = bank_pb.Metadata( |
| 1015 | + description=description, |
| 1016 | + denom_units=[micro_denom_unit, denom_unit], |
| 1017 | + base=denom, |
| 1018 | + display=subdenom, |
| 1019 | + name=name, |
| 1020 | + symbol=symbol, |
| 1021 | + uri=uri, |
| 1022 | + uri_hash=uri_hash, |
| 1023 | + ) |
| 1024 | + return token_factory_tx_pb.MsgSetDenomMetadata(sender=sender, metadata=metadata) |
| 1025 | + |
| 1026 | + def msg_update_params( |
| 1027 | + self, |
| 1028 | + authority: str, |
| 1029 | + denom: str, |
| 1030 | + amount: int, |
| 1031 | + ) -> token_factory_tx_pb.MsgUpdateParams: |
| 1032 | + coin = self.Coin(amount=amount, denom=denom) |
| 1033 | + params = token_factory_params_pb.Params( |
| 1034 | + denom_creation_fee=[coin], |
| 1035 | + ) |
| 1036 | + return token_factory_tx_pb.MsgUpdateParams( |
| 1037 | + authority=authority, |
| 1038 | + params=params, |
| 1039 | + ) |
| 1040 | + |
| 1041 | + def msg_change_admin( |
| 1042 | + self, |
| 1043 | + sender: str, |
| 1044 | + denom: str, |
| 1045 | + new_admin: str, |
| 1046 | + ) -> token_factory_tx_pb.MsgChangeAdmin: |
| 1047 | + return token_factory_tx_pb.MsgChangeAdmin( |
| 1048 | + sender=sender, |
| 1049 | + denom=denom, |
| 1050 | + new_admin=new_admin, |
| 1051 | + ) |
| 1052 | + |
960 | 1053 | def chain_stream_bank_balances_filter( |
961 | 1054 | self, accounts: Optional[List[str]] = None |
962 | 1055 | ) -> chain_stream_query.BankBalancesFilter: |
|
0 commit comments