示例#1
0
 def get_eth_tx_bytes(self) -> bytes:
     data = b"".join([
         serialize_address(self.new_pk_hash),
         serialize_nonce(self.nonce),
         serialize_account_id(self.account_id),
     ])
     if self.eth_auth_data is not None:
         data += self.eth_auth_data.encode_message()
     return data
示例#2
0
 def encoded_message(self) -> bytes:
     return b"".join([
         int_to_bytes(self.tx_type(), 1),
         serialize_account_id(self.initiator_account_id),
         serialize_address(self.target),
         serialize_token_id(self.token.id),
         packed_fee_checked(self.fee),
         serialize_nonce(self.nonce),
         serialize_timestamp(self.valid_from),
         serialize_timestamp(self.valid_until)
     ])
示例#3
0
 def encoded_message(self) -> bytes:
     return b"".join([
         int_to_bytes(0xff - self.tx_type(), 1),
         int_to_bytes(TRANSACTION_VERSION, 1),
         serialize_account_id(self.creator_id),
         serialize_address(self.creator_address),
         serialize_content_hash(self.content_hash),
         serialize_address(self.recipient),
         serialize_token_id(self.fee_token.id),
         packed_fee_checked(self.fee),
         serialize_nonce(self.nonce),
     ])
示例#4
0
 def encoded_message(self) -> bytes:
     return b"".join([
         int_to_bytes(self.tx_type(), 1),
         serialize_account_id(self.account_id),
         serialize_address(self.from_address),
         serialize_address(self.to_address),
         serialize_token_id(self.token.id),
         int_to_bytes(self.amount, length=16),
         packed_fee_checked(self.fee),
         serialize_nonce(self.nonce),
         serialize_timestamp(self.valid_from),
         serialize_timestamp(self.valid_until)
     ])
示例#5
0
 def encoded_message(self) -> bytes:
     return b"".join([
         int_to_bytes(0xff - self.tx_type(), 1),
         int_to_bytes(TRANSACTION_VERSION, 1),
         serialize_account_id(self.account_id),
         serialize_address(self.account),
         serialize_address(self.new_pk_hash),
         serialize_token_id(self.token.id),
         packed_fee_checked(self.fee),
         serialize_nonce(self.nonce),
         serialize_timestamp(self.valid_from),
         serialize_timestamp(self.valid_until)
     ])
示例#6
0
 def encoded_message(self) -> bytes:
     return b"".join([
         int_to_bytes(self.msg_type(), 1),
         int_to_bytes(TRANSACTION_VERSION, 1),
         serialize_account_id(self.account_id),
         serialize_address(self.recipient),
         serialize_nonce(self.nonce),
         serialize_token_id(self.token_sell.id),
         serialize_token_id(self.token_buy.id),
         serialize_ratio_part(self.ratio.numerator),
         serialize_ratio_part(self.ratio.denominator),
         packed_amount_checked(self.amount),
         serialize_timestamp(self.valid_from),
         serialize_timestamp(self.valid_until)
     ])
示例#7
0
 def encoded_message(self) -> bytes:
     order_bytes = b''.join([
         self.orders[0].encoded_message(),
         self.orders[1].encoded_message(),
     ])
     return b"".join([
         int_to_bytes(0xff - self.tx_type(), 1),
         int_to_bytes(TRANSACTION_VERSION, 1),
         serialize_account_id(self.submitter_id),
         serialize_address(self.submitter_address),
         serialize_nonce(self.nonce),
         ZkSyncLibrary().hash_orders(order_bytes),
         serialize_token_id(self.fee_token.id),
         packed_fee_checked(self.fee),
         packed_amount_checked(self.amounts[0]),
         packed_amount_checked(self.amounts[1]),
     ])