Skip to content

Commit 8e63e6e

Browse files
feat: add MsgPrivilegedExecuteContract, MsgInstantiateContract composer (#247)
* feat: add MsgPrivilegedExecuteContract, MsgInstantiateContract composer * chore: update command * chore: add misisng typehints
1 parent c8d68eb commit 8e63e6e

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

pyinjective/composer.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,24 @@ def MsgVote(
900900
return cosmos_gov_tx_pb.MsgVote(
901901
proposal_id=proposal_id, voter=voter, option=option
902902
)
903+
904+
def MsgPrivilegedExecuteContract(self, sender: str, contract: str, msg: str, **kwargs) -> injective_exchange_tx_pb.MsgPrivilegedExecuteContract:
905+
return injective_exchange_tx_pb.MsgPrivilegedExecuteContract(
906+
sender=sender,
907+
contract_address=contract,
908+
data=msg,
909+
funds=kwargs.get('funds') # funds is a string of Coin strings, comma separated, e.g 100000inj,20000000000usdt
910+
)
911+
912+
def MsgInstantiateContract(self, sender: str, admin: str, code_id: int, label: str, message: bytes, **kwargs) -> wasm_tx_pb.MsgInstantiateContract:
913+
return wasm_tx_pb.MsgInstantiateContract(
914+
sender=sender,
915+
admin=admin,
916+
code_id=code_id,
917+
label=label,
918+
msg=message,
919+
funds=kwargs.get('funds'), # funds is a list of cosmos_dot_base_dot_v1beta1_dot_coin__pb2.Coin. The coins in the list must be sorted in alphabetical order by denoms.
920+
)
903921

904922
# data field format: [request-msg-header][raw-byte-msg-response]
905923
# you need to figure out this magic prefix number to trim request-msg-header off the data

0 commit comments

Comments
 (0)