def write_header(hasher: Writer, header: EosTxHeader) -> None: write_uint32_le(hasher, header.expiration) write_uint16_le(hasher, header.ref_block_num) write_uint32_le(hasher, header.ref_block_prefix) write_uvarint(hasher, header.max_net_usage_words) write_uint8(hasher, header.max_cpu_usage_ms) write_uvarint(hasher, header.delay_sec)
def write_action_common(w: Writer, msg: EosActionCommon) -> None: write_uint64_le(w, msg.account) write_uint64_le(w, msg.name) write_uvarint(w, len(msg.authorization)) for authorization in msg.authorization: write_uint64_le(w, authorization.actor) write_uint64_le(w, authorization.permission)
def write_auth(w: Writer, auth: EosAuthorization) -> None: write_uint32_le(w, auth.threshold) write_uvarint(w, len(auth.keys)) for key in auth.keys: write_uvarint(w, key.type) write_bytes_fixed(w, key.key, 33) write_uint16_le(w, key.weight) write_uvarint(w, len(auth.accounts)) for account in auth.accounts: write_uint64_le(w, account.account.actor) write_uint64_le(w, account.account.permission) write_uint16_le(w, account.weight) write_uvarint(w, len(auth.waits)) for wait in auth.waits: write_uint32_le(w, wait.wait_sec) write_uint16_le(w, wait.weight)
def write_auth(w: Writer, auth: EosAuthorization) -> None: write_uint32_le(w, auth.threshold) write_uvarint(w, len(auth.keys)) for key in auth.keys: if key.key is None: raise wire.DataError("Key must be provided explicitly.") write_uvarint(w, key.type) write_bytes_fixed(w, key.key, 33) write_uint16_le(w, key.weight) write_uvarint(w, len(auth.accounts)) for account in auth.accounts: write_uint64_le(w, account.account.actor) write_uint64_le(w, account.account.permission) write_uint16_le(w, account.weight) write_uvarint(w, len(auth.waits)) for wait in auth.waits: write_uint32_le(w, wait.wait_sec) write_uint16_le(w, wait.weight)
def write_bytes_prefixed(w: Writer, data: bytes) -> None: write_uvarint(w, len(data)) write_bytes_unchecked(w, data)
def write_action_voteproducer(w: Writer, msg: EosActionVoteProducer) -> None: write_uint64_le(w, msg.voter) write_uint64_le(w, msg.proxy) write_uvarint(w, len(msg.producers)) for producer in msg.producers: write_uint64_le(w, producer)