Get sign bytes for a transaction using protobuf.
(
msg_type: str,
msg_type_url: str,
msg_bytes: bytes,
tx_time: int,
created_height: int,
fee: int,
memo: str,
network_id: int,
chain_id: int
)
| 166 | |
| 167 | |
| 168 | def get_sign_bytes( |
| 169 | msg_type: str, |
| 170 | msg_type_url: str, |
| 171 | msg_bytes: bytes, |
| 172 | tx_time: int, |
| 173 | created_height: int, |
| 174 | fee: int, |
| 175 | memo: str, |
| 176 | network_id: int, |
| 177 | chain_id: int |
| 178 | ) -> bytes: |
| 179 | """Get sign bytes for a transaction using protobuf.""" |
| 180 | # Create the Any message |
| 181 | any_msg = any_pb2.Any() |
| 182 | any_msg.type_url = msg_type_url |
| 183 | any_msg.value = msg_bytes |
| 184 | |
| 185 | # Create the transaction without signature for signing |
| 186 | tx = tx_pb2.Transaction() |
| 187 | tx.message_type = msg_type |
| 188 | tx.msg.CopyFrom(any_msg) |
| 189 | # signature is not set for sign bytes |
| 190 | tx.created_height = created_height |
| 191 | tx.time = tx_time |
| 192 | tx.fee = fee |
| 193 | if memo: |
| 194 | tx.memo = memo |
| 195 | tx.network_id = network_id |
| 196 | tx.chain_id = chain_id |
| 197 | |
| 198 | # Serialize to bytes (deterministic) |
| 199 | return tx.SerializeToString() |
| 200 | |
| 201 | |
| 202 | def build_sign_and_send_tx( |
no test coverage detected